Repository navigation
Expand file tree
/
Copy pathvite.config.ts
More file actions
47 lines (38 loc) · 1.38 KB
/
Copy pathvite.config.ts
File metadata and controls
47 lines (38 loc) · 1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import path from "node:path";
import { fileURLToPath } from "node:url";
import tailwindcss from "@tailwindcss/vite";
import { tanstackRouter } from "@tanstack/router-plugin/vite";
import react from "@vitejs/plugin-react";
import { defineConfig } from "vite";
const __dirname = path.dirname(fileURLToPath(import.meta.url));
// https://vitejs.dev/config/
export default defineConfig({
plugins: [tanstackRouter({ target: "react", autoCodeSplitting: true }), react(), tailwindcss()],
// Prevent vite from obscuring rust errors
clearScreen: false,
// Tauri expects a fixed port, fail if that port is not available
server: {
port: 5173,
strictPort: true,
watch: {
// Ignore `src-tauri` and the Cargo build output.
ignored: ["**/src-tauri/**", "**/target/**"],
},
},
resolve: {
alias: {
"@": path.resolve(__dirname, "./src"),
},
},
// Env variables starting with TAURI_ are exposed to the frontend
envPrefix: ["VITE_", "TAURI_"],
build: {
// Tauri uses Chromium on Windows and WebKit on macOS and Linux
target: process.env.TAURI_ENV_PLATFORM === "windows" ? "chrome105" : "es2020",
// Produce source maps for debugging
sourcemap: !!process.env.TAURI_ENV_DEBUG,
minify: !process.env.TAURI_ENV_DEBUG ? "esbuild" : false,
// Fallback to original minifier until @tailwindcss/vite supports Vite 8
cssMinify: "esbuild",
},
});