style-loader: HMR does not work as of 1.0.0

  • Operating System: OSX
  • Node Version: Latest
  • NPM Version: Latest
  • webpack Version: Latest
  • style-loader Version: 1.0.0

Expected Behavior

HTR to work as before 1.0.0

Actual Behavior

Ignored an update to unaccepted module kind of errors are thrown and full-reload takes place whenever a change is made in content passed to style-loader.

How Do We Reproduce?

Not sure - I guess try changing css content using the latest version of style-loader.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 10
  • Comments: 34 (16 by maintainers)

Most upvoted comments

@phaistonian I will have a discussion with sokra about it, maybe we can return this faster than you think, in my todo

I will implement it today

@chybisov right now no, sorry, we have new HMR api for webpack@5, maybe we should start to backport it for webpack@4

@evilebottnawi do you have any updates on this? Thank you!

Do not forget that change locals (for example change @value v-color: red; to @value v-color: blue;) still require full page reloading, because we don’t know your logic in component(s), for react you can use react-hot-loader

The main problem is not in the speed of refreshing but in refreshing in general. For example I’m developing some view or component which is deeply nested and with refreshing everything is lost. And I need to go to the exact view by clicking 4 times (on some buttons) and filling forms and submitting 2 forms, for example. You can imagine how much time I spend with such refreshes (during the css bug-fixing for example).

So I got your point on the latest update and it’s fine that it works in the right way, but hot-reload with css-modules is not only convenient but it decreases time of developing also. In this case I can’t use the latest update. Time of developing is number 1 for me.

Could you add some points in Readme and Changelog that can clarify breaking changes for css-modules hot reload?

@Yegorich555 previously version style-loader didn’t work correctly, even if everything seemed to be right for you, technically it was done incorrectly and led to problems in many places, it can be fixed only introducing new hot api, and in theory can be done for webpack@5. What is problem? Refreshing is very fast

yes, because you use css modules and previously behavior break many other cases, it was invalid solution and we revert this

From changelog:

restore original hot reloading behaviour for locals (#419) (f026429)

We implement new HMR api for webpack@5 and it will be possible, right now it is won’t fix