Skip to content
This repository has been archived by the owner on Apr 16, 2019. It is now read-only.

Hot reload JS files when the accompanying CSS Module file changes #47

Merged

Conversation

keegan-lillo
Copy link
Contributor

In this PR:

  • Added example for CSS Modules
  • Removed module.hot.accept(undefined, cssReload); from loader.js

Rationale:

Without this change, CSS Modules don't quite work correctly. If you update a CSS Module file and change a class name, the JS file that is including it, does not get notified of the update. This is because module.hot.accept() breaks the chain. module.hot.dispose(cssReload) is already taking care of replacing the CSS so the second call in module.hot.accept() is unnecessary.

I've created an example to test the implementation.

@shepherdwind shepherdwind merged commit 2665105 into shepherdwind:master Jul 26, 2018
@shepherdwind
Copy link
Owner

shepherdwind commented Jul 26, 2018

New version 1.4.1 published.

I was also troubled by this problem, But I don't know how to fix it. Thanks very much, your pr is great.

@shepherdwind
Copy link
Owner

shepherdwind commented Aug 14, 2018

This change will cause some problem when we don't use css module. For examples #50 #48 .

So, I just add a new option for css module in the latest version 1.4.2, please use it like this https://github.com/shepherdwind/css-hot-loader/pull/51/files#diff-1072d43872977771eca42d15ddb968f2R20 now.

-  'css-hot-loader',
+  'css-hot-loader?cssModule=true',

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

Successfully merging this pull request may close these issues.

2 participants