-
-
Notifications
You must be signed in to change notification settings - Fork 384
Using url() in CSS requires publicPath to be set with Webpack 5 #707
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
Labels
Comments
Thanks a lot for fixing it! |
@evpaassen how do I get the merged fix? Thank you! |
The fix is included in version 1.3.9. So you should just upgrade the mini-css-extract-plugin package. |
@evpaassen forgot to re-run |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Expected Behavior
The situation is: there is a CSS file referencing an asset through
url("...")
, let's say a PNG. This CSS file is loaded bycss-loader
and the PNG byfile-loader
(Webpack 4) or an asset module (Webpack 5). I expect this to work with both Webpack 4 and 5, and a valid CSS file to be produced in thedist
directory.Actual Behavior
Webpack 5 prints the error
Automatic publicPath is not supported in this browser
:However, when I set
output.publicPath
to''
, everything seems to work correctly. With Webpack 4, the issue doesn't exist.More information can also be found here: https://stackoverflow.com/questions/64294706/webpack5-automatic-publicpath-is-not-supported-in-this-browser. This StackOverflow post shows many people are experiencing the issue and there are workarounds available, but there's no real explanation or fix. (I guess it's a bug, because it works with Webpack 4 and Webpack should rely on sensible defaults.)
Code
I created a minimal test case that demonstrates the issue:
How Do We Reproduce?
There is a repository containing a minimal reproduction here: https://github.com/evpaassen/webpack-repro.
master
branch contains a version with Webpack 5. This version shows the error when runningwebpack
.webpack4
branch uses Webpack 4 and this version doesn't show the error and the webpack build just succeeds.I included the Yarn lock file, so you can reproduce the exact same setup using Yarn 1.22.5.
The text was updated successfully, but these errors were encountered: