forked from buriburizaemonnn/RunicSwap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
117 lines (112 loc) · 2.5 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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
/*
import { fileURLToPath, URL } from "url";
import react from "@vitejs/plugin-react";
import { defineConfig } from "vite";
import environment from "vite-plugin-environment";
import dotenv from "dotenv";
dotenv.config({ path: "../../.env" });
export default defineConfig({
build: {
emptyOutDir: true,
},
optimizeDeps: {
esbuildOptions: {
define: {
global: "globalThis",
},
},
},
server: {
proxy: {
"/api": {
target: "http://127.0.0.1:4943",
changeOrigin: true,
},
},
},
plugins: [
react(),
environment("all", { prefix: "CANISTER_" }),
environment("all", { prefix: "DFX_" }),
],
resolve: {
alias: [
{
find: "declarations",
replacement: fileURLToPath(new URL("../declarations", import.meta.url)),
},
],
},
});
*/
import { fileURLToPath, URL } from "url";
import react from "@vitejs/plugin-react";
import { defineConfig } from "vite";
import environment from "vite-plugin-environment";
import dotenv from "dotenv";
import wasm from "vite-plugin-wasm";
import { createHtmlPlugin } from "vite-plugin-html";
import { nodePolyfills } from "vite-plugin-node-polyfills";
dotenv.config({ path: "./.env" });
export default defineConfig({
build: {
emptyOutDir: true,
minify: "terser",
terserOptions: {
compress: {
drop_console: process.env.PROVIDER ? true : false,
drop_debugger: process.env.PROVIDER ? true : false,
},
},
},
optimizeDeps: {
esbuildOptions: {
define: {
global: "globalThis",
},
supported: {
bigint: true,
},
jsx: "automatic",
},
},
server: {
proxy: {
"/api": {
target: "http://127.0.0.1:4943",
changeOrigin: true,
},
},
},
plugins: [
react(),
wasm(),
nodePolyfills({
globals: {
Buffer: false,
global: true,
process: true,
},
protocolImports: false,
}),
createHtmlPlugin({
minify: true,
}),
environment("all", { prefix: "CANISTER_" }),
environment("all", { prefix: "DFX_" }),
],
resolve: {
alias: [
{
find: "declarations",
replacement: fileURLToPath(new URL("../declarations", import.meta.url)),
},
],
},
define: {
"process.env.DFX_NETWORK": JSON.stringify(process.env.DFX_NETWORK),
"process.env.PROVIDER": process.env.PROVIDER
? JSON.stringify(process.env.PROVIDER)
: JSON.stringify("br5f7-7uaaa-aaaaa-qaaca-cai"),
},
});