-
-
Notifications
You must be signed in to change notification settings - Fork 388
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: perform a HMR update after inserting a new CSS module #1006
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am afraid it will reload files very often too, especial for nested @import
@alexander-akait I updated the implementation. It should no longer reload multiple times for nested |
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
} Case 1: Update
|
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 |
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## master #1006 +/- ##
==========================================
+ Coverage 90.33% 90.39% +0.05%
==========================================
Files 5 5
Lines 838 843 +5
Branches 229 230 +1
==========================================
+ Hits 757 762 +5
Misses 71 71
Partials 10 10
☔ View full report in Codecov by Sentry. |
ping @alexander-akait |
@latin-1 Sorry for delay, I am working on built-in CSS supports in webpack webpack/webpack#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