-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathvite.config.ts
More file actions
107 lines (103 loc) · 2.65 KB
/
vite.config.ts
File metadata and controls
107 lines (103 loc) · 2.65 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
import babel from "@rolldown/plugin-babel";
import { tanstackStart } from "@tanstack/react-start/plugin/vite";
import viteReact, { reactCompilerPreset } from "@vitejs/plugin-react";
import { visualizer } from "rollup-plugin-visualizer";
import { defineConfig } from "vite";
const host = process.env.TAURI_DEV_HOST;
export default defineConfig({
base: "",
build: {
// sourcemap: "hidden",
// minify: false,
// don't minify for debug builds
minify: !process.env.TAURI_ENV_DEBUG ? "esbuild" : false,
// produce sourcemaps for debug builds
sourcemap: !!process.env.TAURI_ENV_DEBUG,
},
environments: {
client: {
build: {
target:
process.env.TAURI_ENV_PLATFORM === "windows"
? "chrome105"
: "safari13",
},
},
},
server: {
port: 1420,
// Tauri expects a fixed port, fail if that port is not available
strictPort: true,
// if the host Tauri is expecting is set, use it
host: host || false,
hmr: host
? {
protocol: "ws",
host,
port: 1421,
}
: undefined,
watch: {
// tell vite to ignore watching `src-tauri`
ignored: ["**/src-tauri/**"],
},
},
resolve: {
tsconfigPaths: true,
},
envPrefix: ["VITE_", "TAURI_ENV_"],
plugins: [
visualizer({
emitFile: process.env.NODE_ENV === "production",
filename: "stats.html",
template: "treemap",
}),
tanstackStart({
spa: {
enabled: true,
prerender: {
outputPath: "/index",
},
},
}),
viteReact({
jsxImportSource: "@emotion/react",
}),
babel({
presets: [reactCompilerPreset()],
plugins: [
[
"@emotion/babel-plugin",
{
importMap: {
"@mui/system": {
styled: {
canonicalImport: ["@emotion/styled", "default"],
styledBaseImport: ["@mui/system", "styled"],
},
},
"@mui/material": {
styled: {
canonicalImport: ["@emotion/styled", "default"],
styledBaseImport: ["@mui/material", "styled"],
},
},
"@mui/material/styles": {
styled: {
canonicalImport: ["@emotion/styled", "default"],
styledBaseImport: ["@mui/material/styles", "styled"],
},
},
},
},
],
[
"babel-plugin-direct-import",
{
modules: ["@mui/system", "@mui/material"],
},
],
],
}),
],
});