2023-08-09 16:55:53 +03:00
|
|
|
import react from '@vitejs/plugin-react';
|
|
|
|
import { defineConfig } from 'vite';
|
2023-07-26 23:11:00 +03:00
|
|
|
|
2023-08-13 23:51:48 +03:00
|
|
|
import { dependencies } from './package.json'
|
|
|
|
|
|
|
|
const exclVendors = ['react', 'react-router-dom', 'react-dom']
|
|
|
|
function renderChunks(deps: Record<string, string>) {
|
|
|
|
const chunks = {}
|
|
|
|
Object.keys(deps).forEach((key) => {
|
|
|
|
if (exclVendors.includes(key)) return
|
|
|
|
chunks[key] = [key]
|
|
|
|
})
|
|
|
|
return chunks
|
|
|
|
}
|
|
|
|
|
2023-07-26 23:11:00 +03:00
|
|
|
// https://vitejs.dev/config/
|
|
|
|
export default defineConfig({
|
|
|
|
plugins: [react()],
|
|
|
|
server: {
|
2023-08-09 16:55:53 +03:00
|
|
|
port: 3000
|
2023-08-13 23:51:48 +03:00
|
|
|
},
|
|
|
|
build: {
|
|
|
|
chunkSizeWarningLimit: 4000, // KB
|
|
|
|
sourcemap: false,
|
|
|
|
rollupOptions: {
|
|
|
|
output: {
|
|
|
|
manualChunks: {
|
|
|
|
...renderChunks(dependencies),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2023-07-26 23:11:00 +03:00
|
|
|
}
|
|
|
|
})
|