-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathvite.config.ts
More file actions
87 lines (83 loc) · 2.42 KB
/
vite.config.ts
File metadata and controls
87 lines (83 loc) · 2.42 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
import path from "node:path";
import mkcert from "vite-plugin-mkcert";
import react from "@vitejs/plugin-react-swc";
import tailwindcss from "@tailwindcss/vite";
import glsl from "vite-plugin-glsl";
import { defineConfig } from "vite";
import dotenv from "dotenv";
const nodeEnv = process.env.NODE_ENV ?? "development";
const envFiles = [
`.env.${nodeEnv}.local`,
`.env.${nodeEnv}`,
".env.local",
".env",
];
for (const file of envFiles) {
dotenv.config({ path: file, override: true });
}
export default defineConfig({
plugins: [mkcert(), react(), tailwindcss(), glsl()],
optimizeDeps: {
esbuildOptions: {
tsconfig: "./tsconfig.app.json",
},
},
resolve: {
dedupe: [
"react",
"react-dom",
"three",
"@react-three/fiber",
"@react-three/drei",
"@react-three/rapier",
"@react-three/xr",
],
alias: {
"@": path.resolve(__dirname, "./src"),
react: path.resolve(__dirname, "./node_modules/react"),
"react-dom": path.resolve(__dirname, "./node_modules/react-dom"),
},
extensions: [".ts", ".tsx", ".js", ".jsx", ".json"],
},
build: {
outDir: "./dist",
chunkSizeWarningLimit: 2500,
rollupOptions: {
external: [],
output: {
manualChunks: {
"react-vendor": ["react", "react-dom", "react/jsx-runtime"],
"three-core": ["three"],
"three-libs-1": ["@react-three/fiber", "@react-three/drei"],
"three-libs-2": ["@react-three/rapier", "@react-three/xr"],
"ui-libs": [
"class-variance-authority",
"tailwind-merge",
"clsx",
"lucide-react",
],
},
},
},
},
server: {
host: "0.0.0.0",
port: Number.parseInt(
process.env.VITE_DEVSERVER_PORT ??
process.env.VITE_PREVIEW_PORT ??
"8000",
10
),
open: true,
},
preview: {
host: "0.0.0.0",
port: Number.parseInt(
process.env.VITE_PREVIEW_PORT ??
process.env.VITE_DEVSERVER_PORT ??
"8000",
10
),
open: true,
},
});