Captures the app's first-run setup screen. Also fixes a real bug in vite.config.ts where resolve.conditions was [] for non-Vitest builds, causing Svelte 5 to resolve its SSR export (with a no-op mount stub) instead of the browser client. Adding "browser" to conditions ensures the correct client bundle is used. https://claude.ai/code/session_015rsRzNgDkcqVy815X5hNbm
32 lines
955 B
TypeScript
32 lines
955 B
TypeScript
/// <reference types="vitest/config" />
|
|
import { defineConfig } from "vite";
|
|
import { svelte } from "@sveltejs/vite-plugin-svelte";
|
|
import tailwindcss from "@tailwindcss/vite";
|
|
|
|
const host = process.env.TAURI_DEV_HOST;
|
|
|
|
export default defineConfig({
|
|
plugins: [svelte(), tailwindcss()],
|
|
clearScreen: false,
|
|
server: {
|
|
port: 1422,
|
|
strictPort: true,
|
|
host: host || false,
|
|
hmr: host ? { protocol: "ws", host, port: 1421 } : undefined,
|
|
watch: { ignored: ["**/src-tauri/**"] },
|
|
},
|
|
test: {
|
|
environment: "jsdom",
|
|
globals: true,
|
|
setupFiles: ["./src/test/setup.ts"],
|
|
include: ["src/**/*.{test,spec}.{ts,svelte}"],
|
|
// Resolve Svelte's client (browser) entry under Vitest — without the
|
|
// browser condition mount() picks up Svelte's SSR export and throws
|
|
// lifecycle_function_unavailable.
|
|
server: { deps: { inline: ["@testing-library/svelte"] } },
|
|
},
|
|
resolve: {
|
|
conditions: ["browser"],
|
|
},
|
|
});
|