Skip to content

Commit 4cdea56

Browse files
committed
Split NODE_PATH by local OS delimiter
Empty or undefined paths are sorted out Handle opts.paths provided as a string On Windows, fix browserify test case 'paths.js'
1 parent 574ed9a commit 4cdea56

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

index.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,15 @@ function Deps (opts) {
3636
this.entries = [];
3737
this._input = [];
3838

39-
this.paths = opts.paths || process.env.NODE_PATH;
39+
this.paths = opts.paths || process.env.NODE_PATH || '';
4040
if (typeof this.paths === 'string') {
41-
this.paths = process.env.NODE_PATH.split(':');
41+
this.paths = this.paths.split(path.delimiter);
4242
}
43-
if (!this.paths) this.paths = [];
44-
this.paths = this.paths.map(function (p) {
45-
return path.resolve(self.basedir, p);
46-
});
43+
this.paths = this.paths
44+
.filter(Boolean)
45+
.map(function (p) {
46+
return path.resolve(self.basedir, p);
47+
});
4748

4849
this.transforms = [].concat(opts.transform).filter(Boolean);
4950
this.globalTransforms = [].concat(opts.globalTransform).filter(Boolean);

0 commit comments

Comments
 (0)