-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.js
51 lines (49 loc) · 1.19 KB
/
vite.config.js
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
import { defineConfig, loadEnv } from "vite";
import react from "@vitejs/plugin-react";
import path from "path";
// https://vitejs.dev/config/
export default defineConfig(({ mode }) => {
// Load env file based on `mode` in the current working directory.
// Set the third parameter to '' to load all env regardless of the `VITE_` prefix.
const env = loadEnv(mode, process.cwd(), "");
return {
plugins: [react()],
resolve: {
alias: {
"@": path.resolve(__dirname, "./src"),
},
extensions: [".js", ".jsx"],
},
server: {
port: 3000,
watch: {
usePolling: true,
},
},
optimizeDeps: {
force: true,
esbuildOptions: {
loader: {
".js": "jsx",
},
},
},
esbuild: {
loader: "jsx",
include: /src\/.*\.jsx?$/,
exclude: [],
},
define: {
"process.env": JSON.stringify(env),
"import.meta.env": JSON.stringify({
...env,
DEV: mode === "development",
PROD: mode === "production",
MODE: mode,
}),
"import.meta.env.REACT_APP_RESOURCE_ADDRESS": JSON.stringify(
env.REACT_APP_RESOURCE_ADDRESS
),
},
};
});