Skip to content

Commit fac2703

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

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

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
},

0 commit comments

Comments
 (0)