Files
TalkEdit/frontend/vite.config.ts

31 lines
907 B
TypeScript
Raw Normal View History

import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
2026-03-25 01:22:30 -06:00
// Use TAURI_DEV_HOST when running inside tauri dev, otherwise fall back to localhost.
const host = process.env.TAURI_DEV_HOST;
export default defineConfig({
plugins: [react()],
2026-03-25 01:22:30 -06:00
// Prevent vite from obscuring Rust errors in tauri dev
clearScreen: false,
server: {
port: 5173,
strictPort: true,
2026-03-25 01:22:30 -06:00
host: host || false,
hmr: host ? { protocol: 'ws', host, port: 5174 } : undefined,
watch: {
// Tauri expects a hot reloading mechanism; ignore Rust src changes in Vite
ignored: ['**/src-tauri/**'],
},
},
build: {
outDir: 'dist',
emptyOutDir: true,
2026-03-25 01:22:30 -06:00
// Produces smaller bundle sizes compatible with Tauri's webview
target: ['es2021', 'chrome105', 'safari13'],
minify: !process.env.TAURI_DEBUG ? 'esbuild' : false,
sourcemap: !!process.env.TAURI_DEBUG,
},
});
2026-03-25 01:22:30 -06:00