Mini-css-extract-plugin: When reading from webpack5 filesystem cache imported assets from css are not found

Created on 10 Nov 2020  ·  13Comments  ·  Source: webpack-contrib/mini-css-extract-plugin

  • Operating System: macOS
  • Node Version: 12.14.1
  • NPM Version: 6.13.4
  • webpack Version: 5.4.0
  • mini-css-extract-plugin Version: 1.3.0

Expected Behavior

When webpack is running from cache, output is the same as without.

Actual Behavior

When reading from cache assets imported from css are not found.

Code

https://github.com/piecyk/mini-css-extract-plugin-asset-cache-bug

How Do We Reproduce?

  1. checkout mini-css-extract-plugin-asset-cache-bug
  2. yarn webpack
  3. checkout output from ./dist
./dist/
├── index.html
├── main.css
├── main.js
└── static
    └── webpack-logo.svg
  1. rm -rf ./dist/
  2. yarn webpack
  3. checkout output from ./dist
./dist/
├── index.html
├── main.css
└── main.js
bug

All 13 comments

Yep, bug, mini-css-extract-plugin doesn't work with asset modules, critical, need to fix

Hmm hard to say where or how to start with this 🤔 Obvious workaround is to use file-loader/url-loader rather new assets. Also if someone want's to have a look added testes cases https://github.com/piecyk/mini-css-extract-plugin/tree/bugfix/655 can use this as base branch.

I will send a fix today

Hope, we don't break anything, anyway there is one way to check, release it :smile:

@evilebottnawi works! Thanks 👏

This seems to have broken Webpack 4 compatibility.

v1.3.0 works with Webpack 4
v1.3.1 does not

@Varedis when you speak it is broken please provide reproducible test repo, hard to say what is not working

We have tests for v4 and all works fine, hard-source-webpack-plugin will be never compatibility with this

Maybe this helps, I don't really have the time to make a test repo at the minute, sorry:

using [email protected] and [email protected]:

image

Using [email protected] with the same webpack version and exactly same config works fine.

Please update webpack@4 to the latest stable version

i.e. 4.44.2

We try to avoid supporting old version of webpack, there are a lot of other bugs

Was this page helpful?
0 / 5 - 0 ratings