Skip to content

Commit fd93d3f

Browse files
authored
Merge pull request #101 from anru/fix/respect-to-node-path
respect NODE_PATH env variable while resolving modules
2 parents 729552b + 5e2c8c8 commit fd93d3f

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

file-system-loader.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,15 @@ var FileSystemLoader = (function () {
6969

7070
// if the path is not relative or absolute, try to resolve it in node_modules
7171
if (newPath[0] !== '.' && newPath[0] !== '/') {
72+
var paths;
73+
if (process.env.NODE_PATH) {
74+
paths = process.env.NODE_PATH.split(_path2['default'].delimiter);
75+
}
7276
try {
73-
fileRelativePath = nodeResolve.sync(newPath, { basedir: rootRelativeDir });
77+
fileRelativePath = nodeResolve.sync(newPath, {
78+
basedir: rootRelativeDir,
79+
paths: paths
80+
});
7481
// in this case we need to actualize rootRelativePath too
7582
rootRelativePath = _path2['default'].relative(_this.root, fileRelativePath);
7683
} catch (e) {}

0 commit comments

Comments
 (0)