Bug report
{
module: {
// mini-css-extract-plugin HookWebpackError: Invalid URL: /assets/logo.635a60f2.jpg
generator: {
asset: {
publicPath: '/',
},
},
},
output:{
publicPath:'auto'
}
}
Actual Behavior

Expected Behavior

How Do We Reproduce?
{
module: {
generator: {
asset: {
publicPath: '/',
},
},
},
output:{
publicPath:'auto'
}
}
<!-- A great way to do this is to provide your configuration via a GitHub repository -->
<!-- The most helpful is a minimal reproduction with instructions on how to reproduce -->
<!-- Repositories with too many files or large `webpack.config.js` files are not suitable -->
<!-- Please only add small code snippets directly into this issue -->
<!-- https://gist.github.com is a good place for longer code snippets -->
<!-- If your issue is caused by a plugin or loader, please create an issue on the loader/plugin repository instead -->
### Please paste the results of `npx webpack-cli info` here, and mention other relevant information
I have to chime in to say the loss of support for
publicPath
on the extract plugin causes an incompatibility when importing the same file from both CSS and JavaScript. For example, for a file hosted at/fonts/font.woff
, let’s say you importfont.woff
from inside a CSS file, and then inside a JavaScript file. The lost publicPath support means it’s impossible for the JavaScript output and the CSS output to resolve the same public path correctly. Trying to use different asset/resource configurations (one for CSS and one for JavaScript issuers) also doesn’t work as webpack won’t duplicate the imported font file.With
publicPath
set to “/fonts/”When
publicPath
not setWhen
publicPath
not set on generator, but set to"/fonts/" on the loader plugin options itselfI have the same problem. How to solve it
should work with https://github.com/webpack/webpack/discussions/15613
hm… with one leading slash works fine…
There is solution https://github.com/webpack-contrib/mini-css-extract-plugin/pull/915
@ckken You should not use
generator
in your case, just setWhy? Because you can’t combine
auto
and/
, webpack can’t understand how to calculate valid URLMaybe my example from here helps, as it seems the same issue: https://github.com/webpack/webpack/discussions/14920
The repo: https://github.com/ldrick/webpack_asset_resource