-
-
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
HMR stops updating after first error, reports as unaccepted module #431
Comments
Please create minimum reproducible test repo |
You can't. This relies on interactive behavior reloading in developer mode after a live edit in the .less source file. Or do you actually want just the base |
@rjgotten without reproducible test repo issue was closed because we can't help you with example |
Already figured out the problem. MiniExtract use a pitching loader that starts a child compilation to grab a module produced by If the .less file being compiled contains a syntax error it will cause that child compilation to fail. Your loader will try/catch that, and will at that point propagate the error by passing it to its callback. The whole problem then becomes that the hot module replacement will dispose the old registration, but the new module source that is incoming to replacing it, only throws and doesn't contain any of the hot module registration code needed for a new Here's what I would propose to resolve that problem: Inside the try-catch that guards the execution of the module yielded by the child complation, you should That way, the hot module replacer will register for a future accept and the error becomes recoverable. |
Can you don't ignore my message about reproducible test repo? A lot of developers use less and HMR and no problem was reported, so i want to ensure problem in plugin not in your configuration so i ask you create simple reproducible test repo |
I know the plugin is to blame. And yes; I'll work on a repro case. That'll be during office hours next week. |
Glad to hear, don't forget we need add test for a PR, so reproducible test repo help me solve this fastly with test |
Ofcourse. So I hope you'll settle for a pre-baked project along with some manual instructions to trigger the problem. On a sidenote, something I really feel I have to say, having now stepped into the source-code for MiniCssExtract and coming to grips with the techniques with which it 'does its magic': The ideas behind how it works and how it integrates its hot-reloading is nothing short of genius. |
@evilebottnawi
I have a repro-case of it all just about finished, along with a separate branch showing hardened HMR support in the loader part of MiniCssExtract, so that it can handle recovery even without a full reload. (Kind of cool really. One of the boons of this plugin using a child compiler is that such a flow specifically allows you to intercept the child compilation's errors and handle them yourself in a non-fatal way.) Ah... and that reminds me: |
@rjgotten don't worry, please create reproducible test repo, it is help to me catch problem place and think about solution, hmr is not easy, maybe problem in |
Looks like Github is currently experiencing some difficulties. Just letting you know. |
@rjgotten yep, feel free to ping me |
The testcase is available now as mini-css-extract-plugin-hmr-testcase. The readme contains a few manual instructions. (Sorry, couldn't get that to work automated.) If you want I can also open a PR from the fork. |
Thanks for reproducible test repo, feel free to send a PR anytime |
PR is also up, but there seems to be an issue with the CLA-signing. |
Sorry for big delay, I will look at this tomorrow |
No problem. Stuff like this happens. |
Expected Behavior
Given is a Less file
styles.less
, in which we accidentally introduce an error and then save.HMR attempts an update and it shows the errored compilation.
After fixing the error, HMR should correctly load the fixed compiled CSS.
Actual Behavior
Instead of loading the fixed compiled CSS, HMR reports
Ignored an update to unaccepted module ./styles.less
and fails to update.After having received a failed compilation, the module will continue to not accept hot updates until having manually reloaded the web page.
The text was updated successfully, but these errors were encountered: