-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvite.config.ts
37 lines (36 loc) · 1.12 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
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react-swc";
import { NodeGlobalsPolyfillPlugin } from "@esbuild-plugins/node-globals-polyfill";
// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
// These are polyfills to get @metamask/provider to work in the browser.
// https://gist.github.com/FbN/0e651105937c8000f10fefdf9ec9af3d
resolve: {
alias: {
stream:
"rollup-plugin-node-polyfills/polyfills/stream",
util: "rollup-plugin-node-polyfills/polyfills/util",
buffer: 'rollup-plugin-node-polyfills/polyfills/buffer-es6',
process: 'rollup-plugin-node-polyfills/polyfills/process-es6'
},
// This option is needed for local development
// https://github.com/vitejs/vite/issues/15412
preserveSymlinks: true,
},
optimizeDeps: {
esbuildOptions: {
// Node.js global to browser globalThis
define: {
global: "globalThis",
},
// Enable esbuild polyfill plugins
plugins: [
NodeGlobalsPolyfillPlugin({
process: true,
buffer: true,
}),
],
},
},
});