fix(ivy): ngcc - resolve main
property paths correctly (#31509)
When determining if a `main` path points to a UMD or CommonJS format, the contents of the file need to be loaded and parsed. Previously, it was assumed that the path referred to the exact filename, but did not account for normal module resolution semantics, where the path may be missing an extension or refer to a directory containing an `index.js` file. // FW-1444 PR Close #31509
This commit is contained in:

committed by
Matias Niemelä

parent
fe1793844d
commit
103a5b42ec
@ -115,6 +115,16 @@ runInEachFileSystem(() => {
|
||||
expect(missing.size).toBe(0);
|
||||
expect(deepImports.size).toBe(0);
|
||||
});
|
||||
|
||||
it('should resolve path to the file if it has no extension', () => {
|
||||
const {dependencies, missing, deepImports} =
|
||||
host.findDependencies(_('/external/imports/index'));
|
||||
expect(dependencies.size).toBe(2);
|
||||
expect(missing.size).toBe(0);
|
||||
expect(deepImports.size).toBe(0);
|
||||
expect(dependencies.has(_('/node_modules/lib_1'))).toBe(true);
|
||||
expect(dependencies.has(_('/node_modules/lib_1/sub_1'))).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
function setupMockFileSystem(): void {
|
||||
|
Reference in New Issue
Block a user