ConceptPortal-public/rsconcept/frontend/vite.config.ts

34 lines
715 B
TypeScript
Raw Normal View History

2023-08-09 16:55:53 +03:00
import react from '@vitejs/plugin-react';
import { defineConfig } from 'vite';
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
}
// 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),
},
},
},
}
})