-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvite.config.ts
45 lines (43 loc) · 958 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
35
36
37
38
39
40
41
42
43
44
45
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react-swc";
import dotenv from "dotenv";
import environment from "vite-plugin-environment";
import path from "path";
import wasm from "vite-plugin-wasm";
import topLevelAwait from "vite-plugin-top-level-await";
dotenv.config({ path: ".env" });
// https://vite.dev/config/
export default defineConfig({
root: "src/frontend",
build: {
outDir: "../../dist",
target: "ES2022",
},
optimizeDeps: {
esbuildOptions: {
define: {
global: "globalThis",
},
},
},
server: {
proxy: {
"/api": {
target: "http://127.0.0.1:4943",
changeOrigin: true,
},
},
},
plugins: [
wasm(),
topLevelAwait(),
react(),
environment("all", { prefix: "CANISTER_" }),
environment("all", { prefix: "DFX_" }),
],
resolve: {
alias: {
"@": path.resolve(__dirname, "./src/frontend/src"),
},
},
});