Skip to content

Commit

Permalink
fix(optimize): skip hmr compile for prebundled
Browse files Browse the repository at this point in the history
  • Loading branch information
dominikg committed Jul 27, 2024
1 parent 7c0a7ba commit 2da7dbf
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/healthy-years-battle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sveltejs/vite-plugin-svelte': patch
---

fix(dev): compile with hmr: false for prebundled deps as hmr does not work with that
9 changes: 6 additions & 3 deletions packages/vite-plugin-svelte/src/utils/esbuild.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,12 @@ async function compileSvelte(options, { filename, code }, normalizeFilename, sta
generate: 'client'
};

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

let preprocessed;
Expand Down

0 comments on commit 2da7dbf

Please sign in to comment.