65 lines
2.1 KiB
TypeScript
65 lines
2.1 KiB
TypeScript
import { defineConfig } from "vite";
|
|
import react from "@vitejs/plugin-react-swc";
|
|
import path from "path";
|
|
import { componentTagger } from "lovable-tagger";
|
|
|
|
// https://vitejs.dev/config/
|
|
export default defineConfig(({ mode }) => ({
|
|
server: {
|
|
host: "::",
|
|
port: 8080,
|
|
allowedHosts: [
|
|
"alexandre-pommier.com",
|
|
"www.alexandre-pommier.com",
|
|
"localhost",
|
|
"127.0.0.1",
|
|
"0.0.0.0"
|
|
]
|
|
},
|
|
plugins: [react(), mode === "development" && componentTagger()].filter(Boolean),
|
|
resolve: {
|
|
alias: {
|
|
"@": path.resolve(__dirname, "./src"),
|
|
},
|
|
},
|
|
build: {
|
|
// Optimisations pour la production
|
|
minify: 'esbuild', // Utiliser esbuild au lieu de terser (plus rapide, déjà inclus)
|
|
// Chunking optimal pour de meilleures performances
|
|
rollupOptions: {
|
|
output: {
|
|
manualChunks: {
|
|
'react-vendor': ['react', 'react-dom', 'react-router-dom'],
|
|
'ui-vendor': ['framer-motion', 'lucide-react'],
|
|
'particles': ['@tsparticles/react', '@tsparticles/slim'],
|
|
'radix-ui': [
|
|
'@radix-ui/react-accordion',
|
|
'@radix-ui/react-alert-dialog',
|
|
'@radix-ui/react-avatar',
|
|
'@radix-ui/react-checkbox',
|
|
'@radix-ui/react-collapsible',
|
|
'@radix-ui/react-dialog',
|
|
'@radix-ui/react-dropdown-menu',
|
|
'@radix-ui/react-label',
|
|
'@radix-ui/react-popover',
|
|
'@radix-ui/react-progress',
|
|
'@radix-ui/react-scroll-area',
|
|
'@radix-ui/react-select',
|
|
'@radix-ui/react-separator',
|
|
'@radix-ui/react-slider',
|
|
'@radix-ui/react-slot',
|
|
'@radix-ui/react-switch',
|
|
'@radix-ui/react-tabs',
|
|
'@radix-ui/react-toast',
|
|
'@radix-ui/react-tooltip',
|
|
],
|
|
},
|
|
},
|
|
},
|
|
// Optimisation des assets
|
|
assetsInlineLimit: 4096, // Images < 4kb seront inline en base64
|
|
chunkSizeWarningLimit: 1000, // Augmenter la limite d'avertissement
|
|
sourcemap: false, // Désactiver les sourcemaps en production
|
|
},
|
|
}));
|