Files
Mermix/vite.config.ts
Aleksey Shakhmatov dfafea41f4 chore: scaffold Tauri 2 + Svelte 5 workspace
Standard Tauri layout with a Svelte 5 + TypeScript + Vite frontend and a
Rust backend in src-tauri. Adds build tooling, app/window config,
capabilities, generated icons and the project README.
2026-05-22 16:27:11 +03:00

37 lines
960 B
TypeScript

import { defineConfig } from 'vite';
import { svelte } from '@sveltejs/vite-plugin-svelte';
const host = process.env.TAURI_DEV_HOST;
// https://vitejs.dev/config/
export default defineConfig(async () => ({
plugins: [svelte()],
// Tauri expects a fixed port and fails if it is not available.
clearScreen: false,
server: {
port: 1420,
strictPort: true,
host: host || false,
hmr: host
? {
protocol: 'ws',
host,
port: 1421,
}
: undefined,
watch: {
// Don't watch the Rust backend; tauri handles that.
ignored: ['**/src-tauri/**'],
},
},
// Produce smaller, debuggable bundles depending on the Tauri build profile.
envPrefix: ['VITE_', 'TAURI_'],
build: {
target: process.env.TAURI_ENV_PLATFORM === 'windows' ? 'chrome105' : 'safari13',
minify: !process.env.TAURI_ENV_DEBUG ? 'esbuild' : false,
sourcemap: !!process.env.TAURI_ENV_DEBUG,
},
}));