Skip to content

Commit a1402d9

Browse files
alan-agius4mgechev
authored andcommitted
fix(@ngtools/webpack): NGCC workspace libraries module resolution
Fixes angular#14594
1 parent 302cace commit a1402d9

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

packages/ngtools/webpack/src/ngcc_processor.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,15 @@ export class NgccProcessor {
9797
*/
9898
private tryResolvePackage(moduleName: string, resolvedFileName: string): string | undefined {
9999
try {
100+
let packageJsonPath = path.resolve(resolvedFileName, '../package.json');
101+
if (existsSync(packageJsonPath)) {
102+
return packageJsonPath;
103+
}
104+
100105
// This is based on the logic in the NGCC compiler
101106
// tslint:disable-next-line:max-line-length
102107
// See: https://github.com/angular/angular/blob/b93c1dffa17e4e6900b3ab1b9e554b6da92be0de/packages/compiler-cli/src/ngcc/src/packages/dependency_host.ts#L85-L121
103-
const packageJsonPath = require.resolve(`${moduleName}/package.json`,
108+
packageJsonPath = require.resolve(`${moduleName}/package.json`,
104109
{
105110
paths: [resolvedFileName],
106111
},

tests/legacy-cli/e2e_runner.ts

-2
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,6 @@ if (argv.ivy) {
141141
// Ivy doesn't support i18n externally at the moment.
142142
.filter(name => !name.includes('tests/i18n/'))
143143
.filter(name => !name.endsWith('tests/build/aot/aot-i18n.ts'))
144-
// We don't have a library consumption story yet for Ivy.
145-
.filter(name => !name.endsWith('tests/generate/library/library-consumption.ts'))
146144
// The additional lazy modules array does not work with Ivy because it's not needed.
147145
.filter(name => !name.endsWith('tests/build/dynamic-import.ts'))
148146
// We don't have a platform-server usage story yet for Ivy.

0 commit comments

Comments
 (0)