-
-
Notifications
You must be signed in to change notification settings - Fork 196
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
URLs are being treated as relative, without relative-url option #112
Comments
As I can tell from source codes |
Hi, I'm facing the same issue. From what I saw from the code, it comes from the fact that less-loader override the less.FileManager.prototype and file resolution is left to webpack loaderUtils.urlToRequest resolver which does not treat the filename as an external URL and assume it is local. However, I don't know if it is less responsability or webpack's to resolve external URL. I did not see any documentation on that in the resolve section of the webpack documentation. the same issue occurs on webpack 2.10-beta26 |
The same issue arises basically if you want to import a file like However due to the fact that That's really a pitty as I cannot seriously consider using webpack with less until this is fixed! |
This should help to reproduce the issue: https://github.com/mediafreakch/webpack-less-loader-bug |
Hi, any updates on this? I'm trying to do this: @import url('https://mycdn.com/test.less'); but it fails with:
|
ah I figured it out! I believe the webpack resolver was the issue. What I did was instead of:
use:
By using the Now, it works when I do:
|
+1, I also facing the same issue. |
The only problem with @VictorChen's solution is that you loose all aliasing; how is this that difficult to fix, seems like it should be pretty simple to see if it starts with a network protocol no? @import url(https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic&subset=latin);
^
Can't resolve './https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic&subset=latin' Edit forgot to do my diligence, this is using |
quick update after some more digging around, the workaround that I have for now is this: e("@import url(https://fonts.googleapis.com/css?family=Lato:400,400i,700,700i)"); |
try this: reference: less/less.js#3188 |
This works perfectly ,thank you |
Fixed in master, release will be soon |
I'm trying to use the less-loader to load a less file with a url import at the top. This url import is for a file that is hosted elsewhere (on a cdn).
app.less
When I try to load this less file with the less-loader, I get the following error:
It appears that the less loader is treating my url import as a relative path, instead of actually detecting that it is its own url that contains a resource to be fetched.
My webpack config looks like this:
Any thoughts on why this might be happening? I think it might have something to do with the type of file I'm trying to import (a less file) because if I swap my import with a css file instead (hosted on one of google's CDNs for example) then the resolution happens fine.
I've tried with and without quotes around the url.
webpack v 1.13.1
webpack-dev-server v 1.14.1
less loader v 2.2.3
The text was updated successfully, but these errors were encountered: