You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Let me start saying that I'm not sure this should be considered a bug, but given that HMR for .css doesn't work in some cases while exctraction itself works it might be considered a bug.
Before filling expected and actual behaviour sections I wanted to set the stage for the setup:
We use following (simplified to only cover mini-css-extract-plugin specific setting) splitChunks configuration (which is meant to create single .css file due to lot of specifity/ordering issues we had when css files were appended as templates (pages) were evaluated (those templates were split into their own chunk with dynamic imports):
This works generally (extraction part), but HMR doesn't fully. When .css file that is imported by template that currently is not evaluated by browser we don't get styles hot reload. We can refresh browser and that works (because extraction does work).
My naive explanation for this is that webpack runtime does receive hot-update, but discards it because modules that changed aren't actually loaded.
Is this something that should be handled by mini-css-extract-plugin? If not - is there a way to "trick" webpack runtime into thinking that all css/mini-extract modules are actually loaded and should "hot reload" even if their parents (modules that import them) were not loaded yet?
Expected Behavior
Given above splitChunksconfiguration I would expect mini-css-extract-plugin to be aware of it and be able to hot reload styles even if those are imported by currently not loaded JS modules
Actual Behavior
Only .css whose parent modules are loaded do hot reload.
14.2.0
6.14.4
5.23.0
1.3.8
Let me start saying that I'm not sure this should be considered a bug, but given that HMR for
.css
doesn't work in some cases while exctraction itself works it might be considered a bug.Before filling expected and actual behaviour sections I wanted to set the stage for the setup:
We use following (simplified to only cover
mini-css-extract-plugin
specific setting)splitChunks
configuration (which is meant to create single .css file due to lot of specifity/ordering issues we had when css files were appended as templates (pages) were evaluated (those templates were split into their own chunk with dynamic imports):This works generally (extraction part), but HMR doesn't fully. When
.css
file that is imported by template that currently is not evaluated by browser we don't get styles hot reload. We can refresh browser and that works (because extraction does work).My naive explanation for this is that webpack runtime does receive
hot-update
, but discards it because modules that changed aren't actually loaded.Is this something that should be handled by
mini-css-extract-plugin
? If not - is there a way to "trick" webpack runtime into thinking that allcss/mini-extract
modules are actually loaded and should "hot reload" even if their parents (modules that import them) were not loaded yet?Expected Behavior
Given above
splitChunks
configuration I would expectmini-css-extract-plugin
to be aware of it and be able to hot reload styles even if those are imported by currently not loaded JS modulesActual Behavior
Only
.css
whose parent modules are loaded do hot reload.Code
In reproduction 👇
How Do We Reproduce?
https://github.com/pieh/mini-css-extract-plugin-weird-split-chunks
Reproduction steps in README
The text was updated successfully, but these errors were encountered: