Skip to content
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

lazyStyleTag breaks HMR #467

Closed
rhendric opened this issue Apr 28, 2020 · 2 comments · Fixed by #468
Closed

lazyStyleTag breaks HMR #467

rhendric opened this issue Apr 28, 2020 · 2 comments · Fixed by #468

Comments

@rhendric
Copy link

  • Operating System: Arch Linux
  • Node Version: v13.13.0
  • NPM Version: 6.14.4
  • webpack Version: 4.43.0
  • style-loader Version: 1.2.0

Expected Behavior

When a CSS stylesheet is loaded via style-loader and injectType: 'lazyStyleTag', and HMR is enabled, updating the stylesheet file should result in the style being hot replaced in the browser, regardless of the current state of the use/unuse ref count. (If the style is unused at the time, the changes should be visible when the style is next used.)

Actual Behavior

If the style is in use, then the change is visible, but as soon as the style is unused and then used again (or if the style is unused at the time of the HMR event), then the style reverts to its original value until the page is cold reloaded.

Code + How Do We Reproduce?

Check out https://github.com/rhendric/upgraded-spork for a minimal reproduction. Clicking the button toggles the stylesheet on and off. Edit the background color in src/index.css and then click the button a few times to reproduce the issue.

@alexander-akait
Copy link
Member

Thanks for the issue, it is bug, WIP

@rhendric
Copy link
Author

Thank you for a fast fix and release! 1.2.1 works for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants