Skip to content

Commit b271e20

Browse files
authored
Merge pull request webpack-contrib#137 from shama/fix-relative
Make PathCache stylus resolving a little more like stylus standalone
2 parents 28c0c5f + dfc9e57 commit b271e20

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

lib/pathcache.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,8 @@ function resolvers(options, webpackResolver) {
9696
path += '.styl';
9797
}
9898

99-
var found = utils.find(path, options.paths, options.filename)
99+
var paths = options.paths.concat(context);
100+
var found = utils.find(path, paths, options.filename)
100101
if (found) {
101102
return normalizePaths(found);
102103
}
@@ -110,7 +111,8 @@ function resolvers(options, webpackResolver) {
110111
return null;
111112
}
112113

113-
var found = utils.lookupIndex(path, options.paths, options.filename);
114+
var paths = options.paths.concat(context);
115+
var found = utils.lookupIndex(path, paths, options.filename);
114116
if (found) {
115117
return {path: normalizePaths(found), index: true};
116118
}

test/basic.test.js

+1
Original file line numberDiff line numberDiff line change
@@ -164,5 +164,6 @@ describe("basic", function() {
164164
(typeof css).should.be.eql("string");
165165
css.should.match(/\.a-color/);
166166
css.should.match(/\.b-color/);
167+
css.should.not.match(/\.c-color/);
167168
});
168169
});

test/fixtures/context/color.styl

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.c-color {
2+
color: #ccc;
3+
}

0 commit comments

Comments
 (0)