-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvite.config.ts
43 lines (40 loc) · 1.04 KB
/
vite.config.ts
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 process from "node:process";
import { defineConfig, loadEnv } from "vite";
import react from "@vitejs/plugin-react";
import tsconfigPaths from "vite-tsconfig-paths";
import { checker } from "vite-plugin-checker";
export default defineConfig(({ mode }) => {
const envPrefix = ["VITE", "APP_PORT"];
const viteLoadedEnv = loadEnv(mode, __dirname, envPrefix);
process.env = Object.assign(process.env, viteLoadedEnv);
const devPort = parseInt(process.env.APP_PORT || "3000", 10);
return {
build: {
emptyOutDir: true,
},
optimizeDeps: {
exclude: ["node_modules/.cache"],
},
envPrefix: envPrefix,
plugins: [
react(),
tsconfigPaths({
projects: ["./tsconfig.json", "./tsconfig.app.json"],
}),
checker({
enableBuild: true,
typescript: true,
eslint: false,
root: process.cwd(),
overlay: {
initialIsOpen: false,
position: "br",
},
}),
],
server: {
port: devPort,
strictPort: true,
},
};
});