-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
112 lines (111 loc) · 2.72 KB
/
vite.config.ts
File metadata and controls
112 lines (111 loc) · 2.72 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import path from 'path'
import { nodePolyfills } from 'vite-plugin-node-polyfills'
export default defineConfig({
plugins: [
react(),
nodePolyfills({
protocolImports: true,
globals: {
Buffer: true,
global: true,
process: true,
},
}),
],
resolve: {
alias: {
'@': path.resolve(__dirname, 'src'),
'@shared': path.resolve(__dirname, 'shared'),
},
},
define: {
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'development'),
global: 'globalThis',
},
server: {
host: '0.0.0.0',
port: 5000,
hmr: {
host: process.env.REPLIT_DEV_DOMAIN,
clientPort: 443,
protocol: 'wss'
},
headers: {
'Cache-Control': 'no-cache, no-store, must-revalidate',
'Pragma': 'no-cache',
'Expires': '0'
},
allowedHosts: true,
proxy: {
'/api': {
target: 'http://localhost:3001',
changeOrigin: true,
secure: false
}
}
},
build: {
minify: 'terser',
terserOptions: {
compress: {
drop_console: true,
drop_debugger: true,
passes: 2
},
mangle: {
safari10: true
}
},
reportCompressedSize: false,
chunkSizeWarningLimit: 500,
assetsInlineLimit: 8192,
cssCodeSplit: true,
rollupOptions: {
output: {
manualChunks: (id) => {
if (id.includes('node_modules')) {
if (id.includes('react') || id.includes('react-dom') || id.includes('react-router')) {
return 'vendor';
}
if (id.includes('framer-motion')) {
return 'animations';
}
if (id.includes('three')) {
return 'three';
}
if (id.includes('@solana/web3.js') || id.includes('@solana/spl-token')) {
return 'solana';
}
if (id.includes('@metaplex-foundation')) {
return 'metaplex';
}
if (id.includes('ethers')) {
return 'ethers';
}
if (id.includes('@radix-ui')) {
return 'radix';
}
if (id.includes('@tanstack/react-query')) {
return 'query';
}
return 'vendor-other';
}
},
assetFileNames: 'assets/[name]-[hash][extname]',
chunkFileNames: 'js/[name]-[hash].js',
entryFileNames: 'js/[name]-[hash].js'
}
}
},
optimizeDeps: {
include: ['react', 'react-dom', 'buffer', 'process', 'assert', 'three'],
esbuildOptions: {
define: {
global: 'globalThis'
},
target: 'esnext'
}
}
})