forked from spoo-vault/spoovault
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.js
More file actions
74 lines (69 loc) · 1.97 KB
/
Copy pathvite.config.js
File metadata and controls
74 lines (69 loc) · 1.97 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
import { defineConfig, loadEnv } from 'vite'
import react from '@vitejs/plugin-react'
const getVendorChunk = (id) => {
const normalizedId = id.replace(/\\/g, '/')
if (!normalizedId.includes('/node_modules/')) return undefined
if (normalizedId.includes('/node_modules/ethers/')) return 'vendor-ethers'
if (
normalizedId.includes('/node_modules/@stellar/stellar-sdk/') ||
normalizedId.includes('/node_modules/@stellar/freighter-api/') ||
normalizedId.includes('/node_modules/@stellar/stellar-base/')
) {
return 'vendor-stellar'
}
if (
normalizedId.includes('/node_modules/@react-aria/') ||
normalizedId.includes('/node_modules/@react-stately/') ||
normalizedId.includes('/node_modules/@react-types/') ||
normalizedId.includes('/node_modules/@internationalized/')
) {
return 'vendor-aria'
}
if (normalizedId.includes('/node_modules/framer-motion/')) {
return 'vendor-motion'
}
if (
normalizedId.includes('/node_modules/@heroui/') ||
normalizedId.includes('/node_modules/tailwind-variants/')
) {
return 'vendor-heroui'
}
if (
normalizedId.includes('/node_modules/react/') ||
normalizedId.includes('/node_modules/react-dom/') ||
normalizedId.includes('/node_modules/react-router-dom/')
) {
return 'vendor-react'
}
return undefined
}
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd(), '')
return {
plugins: [react()],
server: {
port: 3000,
open: true,
host: true
},
define: {
'process.env': env
},
build: {
outDir: 'dist',
sourcemap: true,
chunkSizeWarningLimit: 900,
rollupOptions: {
input: {
main: 'index.html',
'service-worker': 'src/sw.ts'
},
output: {
manualChunks: getVendorChunk,
entryFileNames: (chunkInfo) =>
chunkInfo.name === 'service-worker' ? 'sw.js' : 'assets/[name]-[hash].js'
}
}
}
}
})