diff --git a/web/vite.config.ts b/web/vite.config.ts index 0002ade..f762733 100644 --- a/web/vite.config.ts +++ b/web/vite.config.ts @@ -9,8 +9,10 @@ import { VitePWA } from 'vite-plugin-pwa'; const buildId = Date.now().toString(); export default defineConfig(({ mode }) => ({ - // Vitest resolves the `browser` export of Svelte, so effects re-run in tests like in the app. - resolve: { conditions: mode === 'test' ? ['browser'] : [] }, + // Vitest needs the `browser` export of Svelte so that effects re-run in tests like in the app. + // Builds must not set `resolve.conditions`: an explicit list replaces Vite's defaults and + // resolves Svelte to its server build, where onMount is a no-op that gets tree-shaken away. + ...(mode === 'test' ? { resolve: { conditions: ['browser'] } } : {}), plugins: [ sveltekit(), VitePWA({