-
Notifications
You must be signed in to change notification settings - Fork 1
/
vite.config.ts
47 lines (41 loc) · 954 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 dotenv from "dotenv";
import environment from "vite-plugin-environment";
import viteReact from "@vitejs/plugin-react";
import path from "path"
dotenv.config({ path: ".env" });
process.env.II_URL =
process.env.DFX_NETWORK === "local"
? `http://${process.env.CANISTER_ID_INTERNET_IDENTITY}.localhost:4943`
: `https://identity.ic0.app`;
export default defineConfig({
build: {
emptyOutDir: true,
},
resolve: {
alias: {
"@": path.resolve(__dirname, "./src/frontend"),
},
},
optimizeDeps: {
esbuildOptions: {
define: {
global: "globalThis",
},
},
},
server: {
proxy: {
"/api": {
target: "http://127.0.0.1:4943",
changeOrigin: true,
},
},
},
plugins: [
viteReact(),
environment("all", { prefix: "CANISTER_" }),
environment("all", { prefix: "DFX_" }),
environment(['II_URL']),
],
});