-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
46 lines (44 loc) · 1.08 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
import react from '@vitejs/plugin-react-swc'
import {defineConfig, splitVendorChunkPlugin} from 'vite'
import svgr from 'vite-plugin-svgr'
// https://vitejs.dev/config/
export default defineConfig({
build: {
minify: true,
modulePreload: {
polyfill: true
},
rollupOptions: {
output: {
assetFileNames: '[name].[ext]',
chunkFileNames: '[name].js',
entryFileNames: 'main.js',
format: 'es',
manualChunks: (id: string) => {
if (id.includes('antd-')) {
return 'antd-misc'
}
if (id.includes('antd')) {
return 'antd'
}
}
},
preserveEntrySignatures: 'strict'
}
},
plugins: [
react(),
svgr(),
{
configureServer: (server) => {
server.middlewares.use((_req, res, next) => {
res.setHeader('Cross-Origin-Embedder-Policy', 'require-corp')
res.setHeader('Cross-Origin-Opener-Policy', 'same-origin')
next()
})
},
name: 'vite-plugin-corp-headers'
},
splitVendorChunkPlugin()
]
})