-
-
Notifications
You must be signed in to change notification settings - Fork 161
Add hot reloading #24
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
Conversation
08205b4
to
31efe85
Compare
Thank you @clessg for the addition. I really like the suggestions. However, given that this is non-webpack specific package, this needs to be configurable. Could you update the PR to make this behaviour configurable using |
I did not have to add this to get hot reloading working in my own webpack 2 setup. Perhaps it's because I'm using |
@gajus Silly me. I forgot not everybody uses webpack yet. I'll update the PR asap. @tsnieman Yeah, RHL 3 does, incidentally, cause CSS modules to be hot reloaded, though I'm not sure it's intentional. We could just tell people to use RHL, but it's been unstable for a long time, and is currently painful & time-consuming to set up. I've never successfully added RHL 3 to any of my projects - there's always bugs or unexpected behavior. |
🥇 |
Please add a description of the configuration to https://github.com/gajus/babel-plugin-react-css-modules#configuration. |
Ha, I literally just did that. |
@gajus Before I head out, is there anything else that obviously needs fixed/changed? |
Not on the surface of it. I am going to pull the branch and test it out. |
Sounds good. 👍 |
Thank you @clessg ! |
Hot reloading of CSS modules does not work out-of-the-box -
module.hot.accept
has to be used. Ideally, it's placed right by the component importing the CSS:This is a pain to repeat for every single component. Fortunately, we can modify the AST to add it automatically.