-
-
Notifications
You must be signed in to change notification settings - Fork 608
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error can't find module when using less-loader and "module" options #74
Comments
@zxcabs are you using your |
@nkbt No, it's simple less file
|
That is hard to tell, could be even some typo... If you could make a simple repo to reproduce the issue |
I'm actually having the same issue trying to convert my current project to CSS Modules. |
That is interesting. When I migrated our sprockets build with sass and all that kind of stuff - I had almost no issues. The only issue I had was - not correctly resolved path inside imported files and different mixins. But in general everything worked like a charm. |
non-module mode
returns module mode
gives |
can anybody fix it? 😺 |
@zxcabs I kind of debugged all the chain and it is quite clear where exactly the issue, but that code was written on purpose... When I changed: if(!moduleMode) urlRequest = loaderUtils.urlToRequest(url, root);
return "\"+require(" + loaderUtils.stringifyRequest(this, urlRequest) + ")+\""; to urlRequest = loaderUtils.urlToRequest(url, root);
return "\"+require(" + loaderUtils.stringifyRequest(this, urlRequest) + ")+\""; Everything works fine. |
@zxcabs @markdalgleish lol, you know what worked? No changes to loader at all. |
oh 😄 |
Any update on this? |
@moroshko we're still waiting to hear back on this issue in Less: less/less.js#2615 |
Not sure if this still an issue?, but this could be cause your package json has less in devdeps have you tried less-loader instead of less? |
It's stiil an issue. I have to load images via url("../folder/img.jpg") instead of just url("img.jpg") which is very inconvinient. |
make sure you install |
It's installed. Still doesn't work. |
Getting the same error as mmakarin. |
My workaround was that I've created additional temporary loader called (just local module.exports = function (content) {
return content.
replace(/url\(('|")*(\.\/)*(.+?)('|")*\)/g, 'url(./$3)').
replace(/\.\/((https?|ftp):\/\/)/, '$1');
}; And using it in loaders: [
'style',
'css?modules&importLoaders=1&localIdentName=[local]___[hash:base64:5]',
path.resolve('./_less-loader-fix'),
'less'
] Present |
have the same problem as mmakarin.. but |
have the same the problem too. |
+1 on this problem |
+1 meet this problem too. using ../dir_name to return the same root works for me. |
+1 have the same the problem #2615 |
still working |
|
Still does not work... 😟 footer/footer.less
versions
|
@NicoBurno StackTrace (Error) please |
@michael-ciniawsky there are two error sections: Section 1
Section 2
|
Any update to this? Having near-exactly the same error as @NicoBurno - Using: |
@neutraali it have some issue becouse of postcss-loader. i'm still trying to understand it |
Had the same with webpack 2 and css-modules on |
@neutraali update did not help: @Bnaya I localized the problem. But I do not understand why this code works like this ... |
So why does |
@michael-ciniawsky This is still an issue with less-loader 4.0.3. Please re-open 😢 |
hmm this seems to be an issue when just using postcss-loader as well. |
adding resolve-url-loader fixes this for me |
@mnpenner @bradennapier can your provide minimum reproducible test repo? |
Erm... I can't reproduce this is a new project. |
For me, bug not related to |
This is what worked for me. Add to webpack config the following lines
|
@smashercosmo I can not understand why it works。。It is surprise |
Just traced my |
Still a bug with scss files and sass-loader (v8.0.2):
|
Hello,
when i use
"background: url(./icon.png)"
in my less file i got errorModule not found: Error: Cannot resolve module 'icon.png'
.Here part of
webpack.config.js
fileIf remove module options or less-loader all works well.
The text was updated successfully, but these errors were encountered: