Skip to content
This repository has been archived by the owner on Apr 9, 2022. It is now read-only.

Commit

Permalink
fix(@schematics/angular): support import of lib secondary entrypoints
Browse files Browse the repository at this point in the history
  • Loading branch information
clydin authored and filipesilva committed May 24, 2018
1 parent 31c2618 commit 4a9a740
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
7 changes: 7 additions & 0 deletions packages/schematics/angular/library/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,13 @@ function updateTsConfig(packageName: string, distRoot: string) {
tsconfig.compilerOptions.paths[packageName] = [];
}
tsconfig.compilerOptions.paths[packageName].push(distRoot);

// deep import & secondary entrypoint support
const deepPackagePath = packageName + '/*';
if (!tsconfig.compilerOptions.paths[deepPackagePath]) {
tsconfig.compilerOptions.paths[deepPackagePath] = [];
}
tsconfig.compilerOptions.paths[deepPackagePath].push(distRoot + '/*');
});
};
}
Expand Down
3 changes: 3 additions & 0 deletions packages/schematics/angular/library/index_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,9 @@ describe('Library Schematic', () => {
expect(tsConfigJson.compilerOptions.paths.foo).toBeTruthy();
expect(tsConfigJson.compilerOptions.paths.foo.length).toEqual(1);
expect(tsConfigJson.compilerOptions.paths.foo[0]).toEqual('dist/foo');
expect(tsConfigJson.compilerOptions.paths['foo/*']).toBeTruthy();
expect(tsConfigJson.compilerOptions.paths['foo/*'].length).toEqual(1);
expect(tsConfigJson.compilerOptions.paths['foo/*'][0]).toEqual('dist/foo/*');
});

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

0 comments on commit 4a9a740

Please sign in to comment.