fix(ivy): ngtsc is unable to detect flat module entry-point on windows (#29453)
Currently when building an Angular project with `ngtsc` and `flatModuleOutFile` enabled, the Ngtsc build will fail if there are multiple source files as root file names. Ngtsc and NGC currently determine the entry-point for multiple root file names by looking for files ending with `/index.ts`. This functionality is technically deprecated, but still supported and currently breaks on Windows as the root file names are not guaranteed to be normalized POSIX-like paths. In order to make this logic more reliable in the future, this commit also switches the shim generators and entry-point logic to the branded path types. This ensures that we don't break this in the future. PR Close #29453
This commit is contained in:

committed by
Miško Hevery

parent
e57ed61448
commit
1e5a818719
@ -2669,6 +2669,21 @@ describe('ngtsc behavioral tests', () => {
|
||||
expect(jsContents).toContain('export * from \'./test\';');
|
||||
});
|
||||
|
||||
it('should determine the flat module entry-point within multiple root files', () => {
|
||||
env.tsconfig({
|
||||
'flatModuleOutFile': 'flat.js',
|
||||
});
|
||||
env.write('ignored.ts', 'export const TEST = "this is ignored";');
|
||||
env.write('index.ts', 'export const ENTRY = "this is the entry";');
|
||||
|
||||
env.driveMain();
|
||||
const jsContents = env.getContents('flat.js');
|
||||
expect(jsContents)
|
||||
.toContain(
|
||||
'export * from \'./index\';',
|
||||
'Should detect the "index.ts" file as flat module entry-point.');
|
||||
});
|
||||
|
||||
it('should generate a flat module with an id', () => {
|
||||
env.tsconfig({
|
||||
'flatModuleOutFile': 'flat.js',
|
||||
|
Reference in New Issue
Block a user