Skip to content

Commit

Permalink
fix(@ngtools/webpack): NGCC workspace libraries module resolution
Browse files Browse the repository at this point in the history
  • Loading branch information
alan-agius4 authored and mgechev committed Jun 20, 2019
1 parent 302cace commit a1402d9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
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

0 comments on commit a1402d9

Please sign in to comment.