Skip to content

Commit b6e037a

Browse files
authored
fix(hmr): ensure consistent use of compilerOptions.hmr during prebundling (#956)
1 parent d6c4c02 commit b6e037a

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

.changeset/odd-pens-protect.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@sveltejs/vite-plugin-svelte': patch
3+
---
4+
5+
ensure consistent use of compileOptions.hmr also for prebundling

packages/vite-plugin-svelte/src/utils/esbuild.js

+3-6
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,9 @@ async function compileSvelte(options, { filename, code }, statsCollection) {
7070
generate: 'client'
7171
};
7272

73-
if (compileOptions.hmr) {
74-
if (options.emitCss) {
75-
const hash = `s-${safeBase64Hash(normalize(filename, options.root))}`;
76-
compileOptions.cssHash = () => hash;
77-
}
78-
compileOptions.hmr = false;
73+
if (compileOptions.hmr && options.emitCss) {
74+
const hash = `s-${safeBase64Hash(normalize(filename, options.root))}`;
75+
compileOptions.cssHash = () => hash;
7976
}
8077

8178
let preprocessed;

0 commit comments

Comments
 (0)