Skip to content

Commit

Permalink
fix(@angular-devkit/build-angular): fully resolve project modules
Browse files Browse the repository at this point in the history
  • Loading branch information
clydin authored and hansl committed Sep 26, 2018
1 parent d24db32 commit 228a2ed
Showing 1 changed file with 9 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,18 @@
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
// tslint:disable
// TODO: cleanup this file, it's copied as is from Angular CLI.
import * as fs from 'fs';
import * as path from 'path';
import { resolve } from '@angular-devkit/core/node';

// Resolve dependencies within the target project.
export function resolveProjectModule(root: string, moduleName: string) {
const rootModules = path.join(root, 'node_modules');
if (fs.existsSync(rootModules)) {
return require.resolve(moduleName, { paths: [rootModules] });
} else {
return require.resolve(moduleName, { paths: [root] });
}
return resolve(
moduleName,
{
basedir: root,
checkGlobal: false,
checkLocal: true,
},
);
}

// Require dependencies within the target project.
Expand Down

0 comments on commit 228a2ed

Please sign in to comment.