Skip to content

Commit

Permalink
fix: fix <style module> hmr
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Apr 25, 2020
1 parent 59992ea commit 6cef3fe
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/node/serverPluginHmr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,14 @@ export const hmrPlugin: Plugin = ({ root, app, server, watcher }) => {

const prevStyles = prevDescriptor.styles || []
const nextStyles = descriptor.styles || []
if (prevStyles.some((s) => s.scoped) !== nextStyles.some((s) => s.scoped)) {
if (
prevStyles.some((s) => s.scoped) !== nextStyles.some((s) => s.scoped) ||
// TODO for now we force the component to reload on <style module> change
// but this should be optimizable to replace the __cssMoudles object
// on script and only trigger a rerender.
prevStyles.some((s) => s.module != null) ||
nextStyles.some((s) => s.module != null)
) {
notify({
type: 'vue-reload',
path: servedPath,
Expand Down

0 comments on commit 6cef3fe

Please sign in to comment.