-
Notifications
You must be signed in to change notification settings - Fork 56
/
vite.config.ts
54 lines (53 loc) · 1.22 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
import react from '@vitejs/plugin-react-swc'
import { defineConfig } from 'vite'
import topLevelAwait from 'vite-plugin-top-level-await'
import wasm from 'vite-plugin-wasm'
import { compression } from 'vite-plugin-compression2'
import inject from '@rollup/plugin-inject'
import { nodePolyfills } from 'vite-plugin-node-polyfills'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
react(),
topLevelAwait(),
wasm(),
compression(),
inject({
assert: ['assert', 'default']
}),
nodePolyfills()
],
define: {
'process.env.NODE_DEBUG': 'false',
'process.browser': `"test"`,
'process.version': `"test"`
},
resolve: {
alias: {
'@components': '/src/components',
'@containers': '/src/containers',
'@pages': '/src/pages',
'@static': '/src/static',
'@store': '/src/store',
'@web3': '/src/web3',
'@utils': '/src/utils',
'@/': '/src'
}
},
server: {
host: 'localhost',
port: 3000
},
build: {
target: 'es2020',
rollupOptions: {
external: ['fs/promises', 'path'],
plugins: [inject({ Buffer: ['buffer', 'Buffer'] })]
}
},
optimizeDeps: {
esbuildOptions: {
target: 'es2020'
}
}
})