This repository has been archived by the owner on Dec 10, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathvite.config.ts
76 lines (75 loc) · 2.49 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
/* eslint-disable @typescript-eslint/no-explicit-any */
import { defineConfig, loadEnv } from "vite";
import react from "@vitejs/plugin-react";
import viteTsconfigPaths from "vite-tsconfig-paths";
import svgr from "vite-plugin-svgr";
import { resolve } from "path";
import NodeGlobalsPolyfillPlugin from "@esbuild-plugins/node-globals-polyfill";
import rollupNodePolyFill from "rollup-plugin-polyfill-node";
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd(), "REACT_");
return {
define: {
"process.env.REACT_APP_API_URL": JSON.stringify(env.REACT_APP_API_URL),
"process.env.REACT_APP_AUTH_API_URL": JSON.stringify(env.REACT_APP_AUTH_API_URL),
"process.env.REACT_APP_NETWORK_NAMES": JSON.stringify(env.REACT_APP_NETWORK_NAMES),
"process.env.REACT_APP_JSD_WIDGET_KEY": JSON.stringify(env.REACT_APP_JSD_WIDGET_KEY),
"process.env.REACT_APP_NETWORK": JSON.stringify(env.REACT_APP_NETWORK),
"process.env.REACT_APP_MAINNET_APP_URL": JSON.stringify(env.REACT_APP_MAINNET_APP_URL),
"process.env.REACT_APP_SANCHONET_APP_URL": JSON.stringify(env.REACT_APP_SANCHONET_APP_URL),
"process.env.REACT_APP_BOLNISI_NAME_API": JSON.stringify(env.REACT_APP_BOLNISI_NAME_API),
"process.env.REACT_APP_ADA_HANDLE_API": JSON.stringify(env.REACT_APP_ADA_HANDLE_API),
"process.env.REACT_APP_API_URL_COIN_GECKO": JSON.stringify(env.REACT_APP_API_URL_COIN_GECKO),
"process.env.REACT_APP_FF_GLOBAL_IS_CONWAY_ERA": JSON.stringify(env.REACT_APP_FF_GLOBAL_IS_CONWAY_ERA)
},
optimizeDeps: {
exclude: ["util"],
esbuildOptions: {
define: {
global: "globalThis"
},
plugins: [
NodeGlobalsPolyfillPlugin({
buffer: true
})
]
}
},
// base: "/en/",
resolve: {
alias: {
"src/": resolve(__dirname, "./src/$1"),
crypto: "crypto-browserify",
stream: "stream-browserify",
buffer: "buffer/"
}
},
plugins: [
react({
jsxImportSource: "@emotion/react",
babel: {
plugins: ["@emotion/babel-plugin"]
}
}),
viteTsconfigPaths(),
svgr({
svgrOptions: {
ref: true
},
include: "**/*.svg?react"
})
],
server: {
open: true,
port: 1102
},
build: {
minify: false,
assetsInlineLimit: 0,
rollupOptions: {
plugins: [rollupNodePolyFill()] as any
},
outDir: "build"
}
};
});