webpack: DataUrl can't be generated automatically, because there is no mimetype for
Bug report
What is the current behavior? I activate persistent cache and see this error:
DataUrl can't be generated automatically, because there is no mimetype for "" in mimetype database. Either pass a mimetype via "generator.mimetype" or use type: "asset/resource" to create a resource file instead of a DataUrl
I’ve tracked the input and it is already a Data URL base64, like data:image/gif;base64,R0lGODlhCgAKAJECAAAAAP///////wAA…
.
If the current behavior is a bug, please provide the steps to reproduce.
There’s no such error without persistent cache, so I belive this to be a bug. I have this on private codebase, but I think the reproduction would be to use data urls in webpack-handled files. One of our flawed assets come from import 'react-image-crop/dist/ReactCrop.css';
which in turn uses data url in url()
.
What is the expected behavior? No error in console.
For bugged asset this line got empty string without persistent cache and { encoding: undefined, mimetype: undefined }
with persistent cache.
Other relevant information: webpack version: 5.52 Node.js version: 14.17 Operating System: GNU/Linux Additional tools:
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 30 (15 by maintainers)
Commits related to this issue
- fix missing restore of resourceResolveData fixes #14176 — committed to webpack/webpack by sokra 3 years ago
The fix is working ok on our big codebase. Thanks.
@StreetStrider reproduced, thanks
Thanks, I will look at this tomorrow
@StreetStrider it means some of your plugins break webpack cache
We have them in the legacy part of the codebase which does not causes this errors. In affected codebase
asset
is used.