-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathvite.config.js
More file actions
85 lines (77 loc) · 1.95 KB
/
vite.config.js
File metadata and controls
85 lines (77 loc) · 1.95 KB
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
import react from '@vitejs/plugin-react';
import { defineConfig } from 'vite';
import { nodePolyfills } from 'vite-plugin-node-polyfills';
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
react({
babel: {
targets: [
'last 5 chrome version',
'last 5 firefox version',
'last 5 safari version',
],
plugins: [
['@babel/plugin-proposal-decorators', { version: '2023-11' }],
],
},
}),
nodePolyfills({
// Enable polyfills for specific Node.js modules
include: ['buffer', 'process', 'stream', 'util'],
// Make Buffer available globally
globals: {
Buffer: true,
process: true,
},
}),
],
build: {
outDir: 'build',
sourcemap: true,
chunkSizeWarningLimit: 2048,
target: 'chrome90', // Very specific target to avoid decorator issues
minify: false, // Disable all minification
commonjsOptions: {
transformMixedEsModules: true,
},
rollupOptions: {
output: {
manualChunks: {
preload: ['./src/preload.js'],
'vendor-sdk': ['accumulate.js'],
'vendor-antd': ['antd', '@ant-design/icons', 'rc-field-form'],
'vendor-highlight': ['react-syntax-highlighter'],
'vendor-factom': ['factom'],
'vendor-walletconnect': ['@web3modal/ethers'],
'vendor-web3': [
'ethers',
'eth-sig-util',
'ethereumjs-util',
'secp256k1',
],
},
},
},
},
server: {
// this ensures that the browser opens upon server start
open: true,
// this sets a default port to 3000
port: 3000,
host: '0.0.0.0',
watch: {
useFsEvents: true,
},
},
optimizeDeps: {
esbuildOptions: {
tsconfig: './tsconfig.json',
target: 'es2020',
},
// exclude: ['accumulate.js'],
},
esbuild: {
target: 'chrome90',
},
});