stylus / nib

Stylus mixins, utilities, components, and gradient image generation
http://stylus.github.io/nib
MIT License
1.91k stars 249 forks source link

broken with only one level of relative path #332

Closed JounQin closed 6 years ago

JounQin commented 7 years ago

When I used image.styl with webpack and stylus-loader like the following code: image("./member-index-01.png", cover);, it thrown an error:

ERROR in ./~/.0.23.1@css-loader?-minimize&modules&camelCase&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]&sourceMap!./~/.0.9.1@postcss-loader?sourceMap!./~/.2.3.1@stylus-loader?sourceMap!./src/views/MemberIndex/index.styl
Module not found: Error: Can't resolve 'member-index-01@2x.png' in '/local/Coding/EasyHi/src/views/MemberIndex'
 @ ./~/.0.23.1@css-loader?-minimize&modules&camelCase&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]&sourceMap!./~/.0.9.1@postcss-loader?sourceMap!./~/.2.3.1@stylus-loader?sourceMap!./src/views/MemberIndex/index.styl 6:690-723

However, when I change the code to: image("../MemberIndex/member-index-01.png", cover);, it just works! It's confusing.

Besides, I've tried the stylus-loader option preferPathResolver but it didn't work.