-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
33 lines (32 loc) · 1.11 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
import { defineConfig, loadEnv } from "vite";
import react from "@vitejs/plugin-react";
import path from "path";
// https://vitejs.dev/config/
export default ({ mode }) => {
Object.assign(process.env, loadEnv(mode, process.cwd(), ""));
return defineConfig({
plugins: [react()],
resolve: {
alias: {
"@": path.resolve(__dirname, "./src/"),
components: path.resolve(__dirname, "./src/components"),
types: path.resolve(__dirname, "./src/types"),
styles: path.resolve(__dirname, "./src/styles"),
app: path.resolve(__dirname, "./src/app"),
utils: path.resolve(__dirname, "./src/utils"),
pages: path.resolve(__dirname, "./src/pages"),
hooks: path.resolve(__dirname, "./src/hooks"),
config: path.resolve(__dirname, "./src/config"),
assets: path.resolve(__dirname, "./src/assets"),
api: path.resolve(__dirname, "./src/api"),
},
},
define: {
"process.env.VITE_API_URL": JSON.stringify(
mode === "production"
? process.env.VITE_API_URL
: process.env.VITE_API_URL
),
},
});
};