-
-
Notifications
You must be signed in to change notification settings - Fork 468
Description
When scss file is imported into a React component like this, hot reloading does not work as expected. The scss module was injected/replaced correctly, but new update was not applied.
import styles from "./Foo.scss";
class Foo extends React.Component {
// ...
}Let me clarify this. The old style is removed by style-loader, but the updated new style does not get injected back, causing component loses all of their styles no matter old or updated ones.
After some research I believe the problem is here:
https://github.com/webpack/style-loader/blob/master/index.js#L23
If I removed the if... statement, hot reloading will then work correctly, and doesn't seems like it will break anything.
" // When the styles change, update the <style> tags",
- " if(!content.locals) {",
" module.hot.accept(" + loaderUtils.stringifyRequest(this, "!!" + remainingRequest) + ", function() {",
...
- " }",I can create a PR for this. But I want don't want remove the if... statement just like that. @sokra May I know what is the purpose of this check? Thanks.