-
-
Notifications
You must be signed in to change notification settings - Fork 601
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
v4 tries to resolve the absolute urls in css files and gets an error. #1136
Comments
It is expected and it is breaking change,
Try to open this in browser and you will got same problem. You need refactor your code, if you can't do it (vendor code), you can use |
Do not ignore the issue template, otherwise I will close without answer |
Same issue after updating to css-loader from version 3.6 to 4.1. Webpack is no longer able to resolve paths in my SCSS like '/fonts/font-awesome/fontawesome-webfont.eot?v=4.7.0'. @evilebottnawi Do you have an example of how to fix this using a resolve alias? |
I found the way to fix it using resolve alias, but this is a not a convenient way. I want to store all my images (that used in project html templates and in css/scss stylesheets) in one public path ( I really do not understand what caused the need for this breaking change. Why couldn't you make a way to enable/disable root relative url resolution by some config param? Now i have to use inconvenient way of images store. For now i decided to downgrade to V3 because V4 is unusable with this "improvement". @petertenhoor this workaround works (change path for you way) if you want to follow the new way of using:
After this change webpack copies all resource files that found in this url to dist/assets (or another that you set in config) on every recompilation. This is not big deal in frontend only applications there all resources you can store in source dir and compiler every time copies it in dist folder. But my project (big CMS with templatest generated by php backend) not allowing this. |
@syberon The main problem is that you used the wrong approach for storing assets and got a problem, most likely this approach does not work anywhere. Try to use
I am ready to disappoint you, in the near future you will have to update, because Everyone who got this error is time to review the structure of assets and fix it.
|
I have this rules in my css file:
/img/slider-arrow-left.png
is located at site root (public_html directory) and not to be resolved.In version before v4 it works perfectly and not try to resolve the url because it absolute, but after updating to v4 i get an error
Error: Can't resolve '/img/slider-arrow-right.png' in 'C:\SERVER\projects\laminas\mt4\frontend\src\css'
because css-loader tries to resolve it in frontend src directory.my weback config to parse css:
The text was updated successfully, but these errors were encountered: