Skip to content
This repository was archived by the owner on Apr 4, 2025. It is now read-only.

Commit 6de2e57

Browse files
clydinhansl
authored andcommitted
fix(@angular-devkit/build-angular): favor project node modules with project deps
1 parent 505aac2 commit 6de2e57

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

packages/angular_devkit/build_angular/src/angular-cli-files/utilities/require-project-module.ts

+8-2
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,17 @@
77
*/
88
// tslint:disable
99
// TODO: cleanup this file, it's copied as is from Angular CLI.
10-
10+
import * as fs from 'fs';
11+
import * as path from 'path';
1112

1213
// Resolve dependencies within the target project.
1314
export function resolveProjectModule(root: string, moduleName: string) {
14-
return require.resolve(moduleName, { paths: [root] });
15+
const rootModules = path.join(root, 'node_modules');
16+
if (fs.existsSync(rootModules)) {
17+
return require.resolve(moduleName, { paths: [rootModules] });
18+
} else {
19+
return require.resolve(moduleName, { paths: [root] });
20+
}
1521
}
1622

1723
// Require dependencies within the target project.

0 commit comments

Comments
 (0)