Skip to content

Commit d97b33a

Browse files
y1d7ngyyx990803
andauthored
fix(hmr): entry mod's importers contains css mod invalidate hmr (#3929)
* fix(hmr): entry mod's importers contains css mod invalidate hmr * Update hmr.ts Co-authored-by: Evan You <[email protected]>
1 parent da044db commit d97b33a

File tree

1 file changed

+10
-0
lines changed
  • packages/vite/src/node/server

1 file changed

+10
-0
lines changed

packages/vite/src/node/server/hmr.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,16 @@ function propagateUpdate(
243243
if (!node.importers.size) {
244244
return true
245245
}
246+
247+
// #3716, #3913
248+
// For a non-CSS file, if all of its importers are CSS files (registered via
249+
// PostCSS plugins) it should be considered a dead end and force full reload.
250+
if (
251+
!isCSSRequest(node.url) &&
252+
[...node.importers].every((i) => isCSSRequest(i.url))
253+
) {
254+
return true
255+
}
246256

247257
for (const importer of node.importers) {
248258
const subChain = currentChain.concat(importer)

0 commit comments

Comments
 (0)