Closed delch closed 7 years ago
Questions
sass-loader
? It is requiredTo try
debug
option for resolve-url-loader
and see what directories are being searched.resolve-url-loader
is not needed, remove it and check that the loader chain works without itnit: Always specify full loader name. Meaning style-loader
not style
. You can get nasty name conflicts between loaders and other packages.
@delch any progress?
hello, I had met the same problem using webpack2 with resolve-url-loader, i am using css-loader with options = {modules:true} this is my webpack configuration
use:[
'style-loader',
'resolve-url-loader',
{
loader:'css-loader',
options:{
modules:true,
url:true,
//localIdentName: '[path][name]__[local]--[hash:base64:5]'
localIdentName: '[name]-[local]-[hash:base64:5]',
importLoaders:2,
root:'./'
},
},
'autoprefixer-loader',
]
and this is my css file:
background-image(logo.png)
I get "resolve-url-loader cannot operate: CSS error" and " Can't resolve 'logo.png'" while running webpack
it seem like the url() operation do not run my url-loader config
but if I changed my css code to "background-image: url(resolve-url-loader!./logo.png);"
it work, and my url-loader proceed. could you please help me ?thank you very much!
thanks for reading my terrible english~:D
@gitby15 You should not need this loader if you are only using CSS, generally only SASS or LESS or similar CSS transpiler.
Webpack assets are relative to the import
ed file.
url()
statement is fine.url()
statement is fine, so long as that SASS file goes straight into webpack.The problem comes when you have SASS importing SASS with url()
statement. The asset is no-longer relative to the top SASS file.
If that is the case you need: first-to-last
sass-loader
(with sourcemaps)css-loader
style-loader
I'm going to close as I don't see any bug. We can always reopen.
@delch and @gitby15 please ask further questions here until you are happy.
Anyone else please open a new issue.
ok, thank you very much:D
still having an issue with
I also met this problem, I use one css @import another css , but tell me
Module not found: Error: Can't resolve 'resolve-url' in
my webpack config
module: {
rules: [
{
test: /\.css$/,
use: ExtractTextPlugin.extract({
use: ['css', 'resolve-url']
}),
}
],
},
resolveLoader: {
moduleExtensions: ["-loader"]
},
test.css
@import './test1';
body {
height: 100px
}
test1.css
.child {
background: red
}
please help me thanks
Never shorten loader names. use the loader suffix for the full name.
Do that first and eliminate that as a potential problem.
Any chance of an updated webpack 2 config example, on the front page?
Hello, I try to use resolve-url-loader with sass:
Error:
for each font and image, but with webpack 1 all work fine.