Skip to content

Commit 228a2ed

Browse files
clydinhansl
authored andcommitted
fix(@angular-devkit/build-angular): fully resolve project modules
1 parent d24db32 commit 228a2ed

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

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

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,18 @@
55
* Use of this source code is governed by an MIT-style license that can be
66
* found in the LICENSE file at https://angular.io/license
77
*/
8-
// tslint:disable
9-
// TODO: cleanup this file, it's copied as is from Angular CLI.
10-
import * as fs from 'fs';
11-
import * as path from 'path';
8+
import { resolve } from '@angular-devkit/core/node';
129

1310
// Resolve dependencies within the target project.
1411
export function resolveProjectModule(root: string, moduleName: string) {
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-
}
12+
return resolve(
13+
moduleName,
14+
{
15+
basedir: root,
16+
checkGlobal: false,
17+
checkLocal: true,
18+
},
19+
);
2120
}
2221

2322
// Require dependencies within the target project.

0 commit comments

Comments
 (0)