Skip to content
This repository was archived by the owner on Apr 4, 2025. It is now read-only.

Commit 4a9a740

Browse files
clydinfilipesilva
authored andcommitted
fix(@schematics/angular): support import of lib secondary entrypoints
1 parent 31c2618 commit 4a9a740

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

packages/schematics/angular/library/index.ts

+7
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,13 @@ function updateTsConfig(packageName: string, distRoot: string) {
8282
tsconfig.compilerOptions.paths[packageName] = [];
8383
}
8484
tsconfig.compilerOptions.paths[packageName].push(distRoot);
85+
86+
// deep import & secondary entrypoint support
87+
const deepPackagePath = packageName + '/*';
88+
if (!tsconfig.compilerOptions.paths[deepPackagePath]) {
89+
tsconfig.compilerOptions.paths[deepPackagePath] = [];
90+
}
91+
tsconfig.compilerOptions.paths[deepPackagePath].push(distRoot + '/*');
8592
});
8693
};
8794
}

packages/schematics/angular/library/index_spec.ts

+3
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,9 @@ describe('Library Schematic', () => {
182182
expect(tsConfigJson.compilerOptions.paths.foo).toBeTruthy();
183183
expect(tsConfigJson.compilerOptions.paths.foo.length).toEqual(1);
184184
expect(tsConfigJson.compilerOptions.paths.foo[0]).toEqual('dist/foo');
185+
expect(tsConfigJson.compilerOptions.paths['foo/*']).toBeTruthy();
186+
expect(tsConfigJson.compilerOptions.paths['foo/*'].length).toEqual(1);
187+
expect(tsConfigJson.compilerOptions.paths['foo/*'][0]).toEqual('dist/foo/*');
185188
});
186189

187190
it(`should append to existing paths mappings`, () => {

0 commit comments

Comments
 (0)