Skip to content

Commit da67951

Browse files
substacksubstack
authored andcommitted
fix for undefined dirnames
1 parent 9c742e1 commit da67951

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ Deps.prototype._flush = function () {
135135
Object.keys(files).forEach(function (key) {
136136
var r = files[key];
137137
var pkg = r.pkg || {};
138-
var dir = path.dirname(r.row.file);
138+
var dir = r.row.file ? path.dirname(r.row.file) : self.basedir;
139139
if (!pkg.__dirname) pkg.__dirname = dir;
140140
self.walk(r.row, xtend(self.top, {
141141
filename: path.join(dir, '_fake.js')
@@ -466,7 +466,7 @@ Deps.prototype.lookupPackage = function (file, cb) {
466466
if (cached) return nextTick(cb, null, cached);
467467
if (cached === false) return nextTick(cb, null, undefined);
468468

469-
var dirs = parents(path.dirname(file));
469+
var dirs = parents(file ? path.dirname(file) : self.basedir);
470470

471471
(function next () {
472472
if (dirs.length === 0) {

0 commit comments

Comments
 (0)