-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
43 lines (41 loc) · 1.17 KB
/
Copy pathvite.config.ts
File metadata and controls
43 lines (41 loc) · 1.17 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
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import path from "path";
export default defineConfig(async () => {
const isMobile =
process.env.TAURI_PLATFORM === "android" ||
process.env.TAURI_PLATFORM === "ios";
return {
plugins: [react()],
resolve: {
alias: {
"@": path.resolve(__dirname, "./src"),
},
},
// Tauri expects a fixed port during development
server: {
host: '0.0.0.0',
port: 1420,
strictPort: false,
watch: {
// Tell Vite to ignore watching src-tauri
ignored: ["**/src-tauri/**"],
},
},
// Prevent vite from obscuring Rust errors
clearScreen: false,
envPrefix: ["VITE_", "TAURI_"],
build: {
// Use mobile entry point when building for Android/iOS
rollupOptions: isMobile
? { input: "mobile.html" }
: {},
// Tauri uses Chromium on macOS, so we can target modern features
target: isMobile
? ["es2021", "chrome105"]
: ["es2021", "chrome100", "safari13"],
minify: !process.env.TAURI_DEBUG ? "esbuild" : false,
sourcemap: !!process.env.TAURI_DEBUG,
},
};
});