Skip to content

Commit f67c782

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

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

Lines changed: 8 additions & 2 deletions
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)