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
@ -0,0 +1,28 @@
|
||||
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google Inc. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {findFlatIndexEntryPoint} from '../src/logic';
|
||||
|
||||
describe('entry_point logic', () => {
|
||||
|
||||
describe('findFlatIndexEntryPoint', () => {
|
||||
|
||||
it('should use the only source file if only a single one is specified',
|
||||
() => { expect(findFlatIndexEntryPoint(['/src/index.ts'])).toBe('/src/index.ts'); });
|
||||
|
||||
it('should use the shortest source file ending with "index.ts" for multiple files', () => {
|
||||
expect(findFlatIndexEntryPoint([
|
||||
'/src/deep/index.ts', '/src/index.ts', '/index.ts'
|
||||
])).toBe('/index.ts');
|
||||
});
|
||||
|
||||
it('should normalize the path separators for the found entry point',
|
||||
() => { expect(findFlatIndexEntryPoint(['\\src\\index.ts'])).toBe('/src/index.ts'); });
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user