Skip to content

fix(@ngtools/webpack): NGCC workspace libraries module resolution #14755

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion packages/ngtools/webpack/src/ngcc_processor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,15 @@ export class NgccProcessor {
*/
private tryResolvePackage(moduleName: string, resolvedFileName: string): string | undefined {
try {
let packageJsonPath = path.resolve(resolvedFileName, '../package.json');
if (existsSync(packageJsonPath)) {
return packageJsonPath;
}

// This is based on the logic in the NGCC compiler
// tslint:disable-next-line:max-line-length
// See: https://github.com/angular/angular/blob/b93c1dffa17e4e6900b3ab1b9e554b6da92be0de/packages/compiler-cli/src/ngcc/src/packages/dependency_host.ts#L85-L121
const packageJsonPath = require.resolve(`${moduleName}/package.json`,
packageJsonPath = require.resolve(`${moduleName}/package.json`,
{
paths: [resolvedFileName],
},
Expand Down
2 changes: 0 additions & 2 deletions tests/legacy-cli/e2e_runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,6 @@ if (argv.ivy) {
// Ivy doesn't support i18n externally at the moment.
.filter(name => !name.includes('tests/i18n/'))
.filter(name => !name.endsWith('tests/build/aot/aot-i18n.ts'))
// We don't have a library consumption story yet for Ivy.
.filter(name => !name.endsWith('tests/generate/library/library-consumption.ts'))
// The additional lazy modules array does not work with Ivy because it's not needed.
.filter(name => !name.endsWith('tests/build/dynamic-import.ts'))
// We don't have a platform-server usage story yet for Ivy.
Expand Down