Skip to content

Commit

Permalink
chore: patch vite-plugin-vue to fix CSS files not triggering HMR
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffdowdle committed Jun 4, 2024
1 parent b42a96e commit b4e0f3f
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 13 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@
"vite@>=5.1.0 <=5.1.6": ">=5.1.7"
},
"patchedDependencies": {
"vite-svg-loader@4.0.0": "patches/vite-svg-loader@4.0.0.patch"
"vite-svg-loader@4.0.0": "patches/vite-svg-loader@4.0.0.patch",
"@vitejs/plugin-vue@5.0.4": "patches/@vitejs__plugin-vue@5.0.4.patch"
}
}
}
18 changes: 18 additions & 0 deletions patches/@vitejs__plugin-vue@5.0.4.patch
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,
28 changes: 16 additions & 12 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 b4e0f3f

Please sign in to comment.