import tailwindcss from "@tailwindcss/vite" import { defineConfig } from "vite"; import { svelte } from '@sveltejs/vite-plugin-svelte' const host = process.env.TAURI_DEV_HOST; // https://vite.dev/config/ export default defineConfig({ plugins: [tailwindcss(), svelte()], // Vite options tailored for Tauri development and only applied in `tauri dev` or `tauri build` // // 1. prevent Vite from obscuring rust errors clearScreen: false, // 2. tauri expects a fixed port, fail if that port is not available server: { port: 5173, strictPort: true, host: host || false, hmr: host ? { protocol: "ws", host, port: 1421, } : undefined, watch: { // 3. tell Vite to ignore watching `src-tauri` ignored: ["**/src-tauri/**"], }, }, // Env variables starting with the item of `envPrefix` will be exposed in tauri's source code through `import.meta.env`. envPrefix: ['VITE_', 'TAURI_ENV_*'], build: { // Tauri uses Chromium on Windows and WebKit on macOS and Linux target: process.env.TAURI_ENV_PLATFORM == 'windows' ? 'chrome105' : 'safari13', // don't minify for debug builds minify: !process.env.TAURI_ENV_DEBUG ? 'esbuild' : false, // produce sourcemaps for debug builds sourcemap: !!process.env.TAURI_ENV_DEBUG, }, });