58 lines
1.5 KiB
TypeScript
58 lines
1.5 KiB
TypeScript
import { defineConfig } from 'vite';
|
|
import react from '@vitejs/plugin-react';
|
|
import svgr from 'vite-plugin-svgr';
|
|
import path from 'path';
|
|
|
|
import { miaodaDevPlugin } from "miaoda-sc-plugin";
|
|
|
|
// https://vite.dev/config/
|
|
export default defineConfig({
|
|
plugins: [react(), svgr({
|
|
svgrOptions: {
|
|
icon: true, exportType: 'named', namedExport: 'ReactComponent', }, }), miaodaDevPlugin()],
|
|
resolve: {
|
|
alias: {
|
|
'@': path.resolve(__dirname, './src'),
|
|
},
|
|
},
|
|
build: {
|
|
// Optimize build output
|
|
target: 'es2015',
|
|
minify: 'terser',
|
|
terserOptions: {
|
|
compress: {
|
|
drop_console: true, // Remove console.logs in production
|
|
drop_debugger: true,
|
|
},
|
|
},
|
|
rollupOptions: {
|
|
output: {
|
|
// Manual chunk splitting for better caching
|
|
manualChunks: {
|
|
// Vendor chunks
|
|
'react-vendor': ['react', 'react-dom', 'react-router-dom'],
|
|
'ui-vendor': [
|
|
'@radix-ui/react-dialog',
|
|
'@radix-ui/react-dropdown-menu',
|
|
'@radix-ui/react-select',
|
|
],
|
|
'map-vendor': ['@vis.gl/react-google-maps'],
|
|
'form-vendor': ['react-hook-form', 'zod'],
|
|
'supabase-vendor': ['@supabase/supabase-js'],
|
|
},
|
|
},
|
|
},
|
|
// Chunk size warnings
|
|
chunkSizeWarningLimit: 1000,
|
|
},
|
|
optimizeDeps: {
|
|
// Pre-bundle dependencies for faster dev server
|
|
include: [
|
|
'react',
|
|
'react-dom',
|
|
'react-router-dom',
|
|
'@supabase/supabase-js',
|
|
],
|
|
},
|
|
});
|