-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.ts
34 lines (31 loc) · 924 Bytes
/
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
import { fileURLToPath, URL } from "url"
import react from "@vitejs/plugin-react-swc"
import { defineConfig, splitVendorChunkPlugin, loadEnv } from "vite"
import svgrPlugin from "vite-plugin-svgr"
import viteTsconfigPaths from "vite-tsconfig-paths"
// https://vitejs.dev/config/
export default ({ mode }): any => {
process.env = { ...process.env, ...loadEnv(mode, process.cwd(), "") }
return defineConfig({
// eslint-disable-next-line @typescript-eslint/no-var-requires
// Object.assign(process.env, loadEnv(mode, process.cwd()));
// now you can access config with process.env.{configName}
build: {
target: "esnext",
},
plugins: [
react(),
viteTsconfigPaths(),
svgrPlugin(),
splitVendorChunkPlugin(),
],
resolve: {
alias: {
"@": fileURLToPath(new URL("./src", import.meta.url)),
},
},
server: {
port: 3000,
},
})
}