safari13 causes esbuild to fail on modern destructuring patterns from TanStack Router/Query. In 2026, all WebKit versions that can run Tauri v2 fully support esnext. Use chrome120 for Windows.
33 lines
982 B
TypeScript
33 lines
982 B
TypeScript
import { defineConfig } from "vite";
|
|
import react from "@vitejs/plugin-react";
|
|
import { tanstackRouter } from "@tanstack/router-plugin/vite";
|
|
import tailwindcss from "@tailwindcss/vite";
|
|
import { fileURLToPath } from "url";
|
|
import path from "path";
|
|
|
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
const host = process.env.TAURI_DEV_HOST;
|
|
|
|
export default defineConfig({
|
|
clearScreen: false,
|
|
plugins: [tanstackRouter({ autoCodeSplitting: true }), react(), tailwindcss()],
|
|
resolve: {
|
|
alias: {
|
|
"@": path.resolve(__dirname, "./src"),
|
|
},
|
|
},
|
|
server: {
|
|
port: 5173,
|
|
strictPort: true,
|
|
host: host || false,
|
|
hmr: host ? { protocol: "ws", host, port: 1421 } : undefined,
|
|
watch: { ignored: ["**/src-tauri/**"] },
|
|
},
|
|
envPrefix: ["VITE_", "TAURI_ENV_*"],
|
|
build: {
|
|
target: process.env.TAURI_ENV_PLATFORM === "windows" ? "chrome120" : "esnext",
|
|
minify: !process.env.TAURI_ENV_DEBUG ? "esbuild" : false,
|
|
sourcemap: !!process.env.TAURI_ENV_DEBUG,
|
|
},
|
|
});
|