-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathvite.config.ts
67 lines (63 loc) · 1.84 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
import { defineConfig, splitVendorChunkPlugin } from 'vite'
import react from '@vitejs/plugin-react'
import GlobalsPolyfills from '@esbuild-plugins/node-globals-polyfill'
import { NodeModulesPolyfillPlugin } from '@esbuild-plugins/node-modules-polyfill'
import nodePolyfills from "rollup-plugin-polyfill-node";
import shimReactPdf from "vite-plugin-shim-react-pdf";
// https://vitejs.dev/config/
// https://github.com/vitejs/vite/issues/1973
// on going issues with vite's global and process
export default defineConfig({
base: "./",
server: {
hmr: (process.env.GITPOD_WORKSPACE_URL && (process.env.GITPOD_REMOTE_CLI_IPC)) ? {
host: process.env.GITPOD_WORKSPACE_URL.replace("https://", "3000-"),
protocol: "wss",
clientPort: 443
} : true
},
resolve: {
dedupe: ["buffer","bn.js", "keccak", "ethers"],
},
plugins: [
react(),
shimReactPdf()
],
define: {
global: 'globalThis'
},
publicDir: "./res",
build: {
target: ["esnext"],
rollupOptions: {
plugins: [nodePolyfills()],
output: {
manualChunks: {
"mui" : ["@mui/material"],
}
}
},
},
esbuild: {
jsxFactory: 'jsx',
jsxInject: `import {jsx} from '@emotion/react'`
},
optimizeDeps: {
esbuildOptions: {
target: "esnext",
// Node.js global to browser globalThis
define: {
global: 'globalThis'
},
treeShaking: true,
// Enable esbuild polyfill plugins
plugins: [
GlobalsPolyfills({
buffer: true,
process: true,
}),
NodeModulesPolyfillPlugin()
]
}
}
})