Skip to content

Commit

Permalink
fix(hmr): don't try to rewrite imports for direct CSS soft invalidati…
Browse files Browse the repository at this point in the history
…on (#18252)
  • Loading branch information
sapphi-red committed Oct 14, 2024
1 parent 96084d6 commit 851b258
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/vite/src/node/server/moduleGraph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,10 @@ export class ModuleGraph {
// to only update the import timestamps. If it's not statically imported, e.g. watched/glob file,
// we can only soft invalidate if the current module was also soft-invalidated. A soft-invalidation
// doesn't need to trigger a re-load and re-transform of the importer.
// But we exclude direct CSS files as those cannot be soft invalidated.
const shouldSoftInvalidateImporter =
importer.staticImportedUrls?.has(mod.url) || softInvalidate
(importer.staticImportedUrls?.has(mod.url) || softInvalidate) &&
importer.type !== 'css'
this.invalidateModule(
importer,
seen,
Expand Down

0 comments on commit 851b258

Please sign in to comment.