Skip to content

Commit

Permalink
Merge pull request #1206 from dpc-sdp/chore/R20-1977-css-hmr-fix
Browse files Browse the repository at this point in the history
[R20-1977] - Patch vite-plugin-vue to fix CSS files not triggering HMR
  • Loading branch information
jeffdowdle authored Jun 5, 2024
2 parents 9030ddf + b4e0f3f commit 4345d46
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 9 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@
"vite@>=5.1.0 <=5.1.6": ">=5.1.7"
},
"patchedDependencies": {
"[email protected]": "patches/[email protected]"
"[email protected]": "patches/[email protected]",
"@vitejs/[email protected]": "patches/@[email protected]"
}
}
}
18 changes: 18 additions & 0 deletions patches/@[email protected]
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
diff --git a/dist/index.mjs b/dist/index.mjs
index 651cce2951161bfd811ef55f4ed5c4ed6a676dde..fa381af3d9cc6eab21bd13a41768f8df4940936c 100644
--- a/dist/index.mjs
+++ b/dist/index.mjs
@@ -2917,6 +2917,13 @@ function vuePlugin(rawOptions = {}) {
);
} else {
const descriptor = query.src ? getSrcDescriptor(filename, query) || getTempSrcDescriptor(filename, query) : getDescriptor(filename, options.value);
+
+ // TEMPORARY PATCH: https://github.com/vitejs/vite-plugin-vue/issues/397
+ // Fixes CSS files imported into .vue files not being watched
+ if (query.src) {
+ this.addWatchFile(filename);
+ }
+
if (query.type === "template") {
return transformTemplateAsModule(
code,
19 changes: 11 additions & 8 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 4345d46

Please sign in to comment.