Skip to content

Commit dd479a4

Browse files
committed
fix: tell vite not to optimize clsx
1 parent 3589433 commit dd479a4

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -577,6 +577,10 @@ function buildExtraConfigForSvelte(config) {
577577
if (!isDepExternaled('esm-env', config.ssr?.external ?? [])) {
578578
noExternal.push('esm-env');
579579
}
580+
// prevent server restart when clsx is lazily discovered by vite - it does not need optimization
581+
if (!isDepIncluded('clsx', config.optimizeDeps?.include ?? [])) {
582+
exclude.push('clsx');
583+
}
580584
return { optimizeDeps: { include, exclude }, ssr: { noExternal, external } };
581585
}
582586

0 commit comments

Comments
 (0)