Open latin-1 opened 1 year ago
@alexander-akait I updated the implementation. It should no longer reload multiple times for nested @import
s.
style-a.css
/ \
index.js shared.css
\ /
style-b.css
module.hot.dispose(cssReload); // 1. dispose callback, current behavior
module.hot.accept(undefined, cssReload); // 2. accept callback, current behavior
if (module.hot.status() !== "idle") {
cssReload(); // 3. execute, newly introduced
}
style-a.css
style-a.css
: disposing (1. dispose callback, current behavior)style-a.css
: applying (3. execute, newly introduced)style-b.css
ditto
shared.css
style-b.css
: disposing (1. dispose callback, current behavior)style-a.css
: disposing (1. dispose callback, current behavior)style-a.css
: applying (3. execute, newly introduced)style-b.css
: applying (3. execute, newly introduced)For the case 3, we've already reloaded multiple times. We may consider changing the key
to the script url.
Because disposing and applying running in different contexts, I don't believe there is a better way than tracking in a global state.
Test cases updated.
Hello, sorry for delay, I will look at this today
Patch coverage: 100.00
% and project coverage change: +0.05
:tada:
Comparison is base (
d2516c4
) 90.33% compared to head (77ec64b
) 90.39%.:exclamation: Current head 77ec64b differs from pull request most recent head 32659cd. Consider uploading reports for the commit 32659cd to get more accurate results
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.
ping @alexander-akait
@latin-1 Sorry for delay, I am working on built-in CSS supports in webpack https://github.com/webpack/webpack/issues/14893, it works good for pure CSS (except public path for assets modules, but I want to fix it soon), and we can just copy/paste logic for HMR from https://github.com/webpack/webpack/blob/main/lib/css/CssLoadingRuntimeModule.js
Feel free to ask questions
@alexander-akait got it. thanks for your explanation
This PR contains a:
Motivation / Use-Case
Fixes #706
Breaking Changes
None
Additional Info
This PR is based on #726
Repo for testing: https://github.com/latin-1/mini-css-extract-plugin-706-repro