Skip to content

Commit

Permalink
fix(hmr): entry mod's importers contains css mod invalidate hmr (#3929)
Browse files Browse the repository at this point in the history
* fix(hmr): entry mod's importers contains css mod invalidate hmr

* Update hmr.ts

Co-authored-by: Evan You <yyx990803@gmail.com>
  • Loading branch information
y1d7ng and yyx990803 committed Jun 28, 2021
1 parent da044db commit d97b33a
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions packages/vite/src/node/server/hmr.ts
Expand Up @@ -243,6 +243,16 @@ function propagateUpdate(
if (!node.importers.size) {
return true
}

// #3716, #3913
// For a non-CSS file, if all of its importers are CSS files (registered via
// PostCSS plugins) it should be considered a dead end and force full reload.
if (
!isCSSRequest(node.url) &&
[...node.importers].every((i) => isCSSRequest(i.url))
) {
return true
}

for (const importer of node.importers) {
const subChain = currentChain.concat(importer)
Expand Down

0 comments on commit d97b33a

Please sign in to comment.