fix(ivy): ngtsc fails building flat module out on windows (#27993)
`ngtsc` currently fails building a flat module out file on Windows because it generates an invalid flat module TypeScript source file. e.g: ```ts 5 export * from './C:\Users\Paul\Desktop\test\src\export'; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``` This is because `path.posix.relative` does not properly with non-posix paths, and only expects posix paths in order to work. PR Close #27993
This commit is contained in:

committed by
Alex Rickabaugh

parent
d336bff200
commit
070fca1591
@ -1610,6 +1610,17 @@ describe('ngtsc behavioral tests', () => {
|
||||
expect(dtsContents).toContain('/// <amd-module name="@mymodule" />');
|
||||
});
|
||||
|
||||
it('should generate a proper flat module index file when nested', () => {
|
||||
env.tsconfig({
|
||||
'flatModuleOutFile': './public-api/index.js',
|
||||
});
|
||||
|
||||
env.write('test.ts', `export const SOME_EXPORT = 'some-export'`);
|
||||
env.driveMain();
|
||||
|
||||
expect(env.getContents('./public-api/index.js')).toContain(`export * from '../test';`);
|
||||
});
|
||||
|
||||
it('should report an error when a flat module index is requested but no entrypoint can be determined',
|
||||
() => {
|
||||
env.tsconfig({'flatModuleOutFile': 'flat.js'});
|
||||
|
Reference in New Issue
Block a user