Skip to content

Commit

Permalink
fix(hmr): ensure consistent use of compilerOptions.hmr during prebund…
Browse files Browse the repository at this point in the history
…ling (#956)
  • Loading branch information
dominikg authored Aug 5, 2024
1 parent d6c4c02 commit b6e037a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .changeset/odd-pens-protect.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sveltejs/vite-plugin-svelte': patch
---

ensure consistent use of compileOptions.hmr also for prebundling
9 changes: 3 additions & 6 deletions packages/vite-plugin-svelte/src/utils/esbuild.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,9 @@ async function compileSvelte(options, { filename, code }, statsCollection) {
generate: 'client'
};

if (compileOptions.hmr) {
if (options.emitCss) {
const hash = `s-${safeBase64Hash(normalize(filename, options.root))}`;
compileOptions.cssHash = () => hash;
}
compileOptions.hmr = false;
if (compileOptions.hmr && options.emitCss) {
const hash = `s-${safeBase64Hash(normalize(filename, options.root))}`;
compileOptions.cssHash = () => hash;
}

let preprocessed;
Expand Down

0 comments on commit b6e037a

Please sign in to comment.