-
-
Notifications
You must be signed in to change notification settings - Fork 388
Description
- Operating System: macOS BigSur 11.1
- Node Version:
14.2.0 - NPM Version:
6.14.4 - webpack Version:
5.23.0 - mini-css-extract-plugin Version:
1.3.8
Expected Behavior
When adding new .css import with HMR enabled styles should hot update.
Actual Behavior
Styles are not hot updated. I get:
[HMR] Updated modules:
[HMR] - ./index.js
[HMR] - ./second.css
[HMR] App is up to date.
But no logs that are usually printed when styles reload - from https://github.com/webpack-contrib/mini-css-extract-plugin/blob/470ba0e553386d7c97e7646169e975322c0e5de2/src/hmr/hotModuleReplacement.js#L230-L236
When I save any .css file (can be just resave without any change), only then this newly imported styles are applied:
[HMR] Updated modules:
[HMR] - ./second.css
[HMR] App is up to date.
[HMR] Reload all css
Code
Code in reproduction 👇
But from what I can tell when new css Module (not css-modules, just webpack module :) ). Is loaded this code gets executed - https://github.com/webpack-contrib/mini-css-extract-plugin/blob/470ba0e553386d7c97e7646169e975322c0e5de2/src/loader.js#L11-L30
But this code only setup cssReload function to be executed on next hot update. It doesn't execute it when new module is added for the first time. I guess it might be tricky to potentially execute it only when new module is added, but not on initial code evaluation (first visit in the browser)?
How Do We Reproduce?
https://github.com/pieh/mini-css-extract-plugin-new-css-import
steps listed in README