refactor: update packages to React 19, Vite 8 and Tailwind 4 and modernize configs
This commit is contained in:
@@ -1,66 +1,22 @@
|
||||
import { defineConfig } from 'vite'
|
||||
import react from '@vitejs/plugin-react'
|
||||
import tsconfigPaths from "vite-tsconfig-paths";
|
||||
import tailwindcss from '@tailwindcss/vite'
|
||||
|
||||
// https://vite.dev/config/
|
||||
export default defineConfig(({ command, mode }) => {
|
||||
const isDev = command === 'serve';
|
||||
const isProd = mode === 'production';
|
||||
|
||||
return {
|
||||
export default defineConfig({
|
||||
// Base path otimizado para Netlify
|
||||
base: '/',
|
||||
|
||||
// Otimizações de build para Netlify
|
||||
build: {
|
||||
sourcemap: false, // Desabilitar sourcemaps em produção para reduzir tamanho
|
||||
target: 'es2020',
|
||||
minify: 'esbuild',
|
||||
cssMinify: true,
|
||||
assetsInlineLimit: 4096, // Inline assets menores que 4KB
|
||||
minify: true,
|
||||
emptyOutDir: true,
|
||||
|
||||
// Configurações avançadas de chunk splitting
|
||||
rollupOptions: {
|
||||
output: {
|
||||
// Nomes de arquivo com hash para cache busting
|
||||
chunkFileNames: 'assets/js/[name]-[hash].js',
|
||||
entryFileNames: 'assets/js/[name]-[hash].js',
|
||||
assetFileNames: 'assets/[ext]/[name]-[hash].[ext]',
|
||||
|
||||
// Estratégia de splitting otimizada
|
||||
manualChunks: {
|
||||
// Vendor chunks para melhor cache
|
||||
'react-vendor': ['react', 'react-dom'],
|
||||
'router-vendor': ['react-router-dom'],
|
||||
'query-vendor': ['@tanstack/react-query', '@tanstack/react-query-devtools'],
|
||||
'supabase-vendor': ['@supabase/supabase-js'],
|
||||
'ui-vendor': ['lucide-react', 'framer-motion', 'sonner'],
|
||||
'form-vendor': ['react-hook-form', '@hookform/resolvers', 'zod'],
|
||||
'state-vendor': ['zustand', 'dexie']
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
// Configurações de compressão otimizadas para Netlify
|
||||
reportCompressedSize: false,
|
||||
chunkSizeWarningLimit: 1000,
|
||||
|
||||
// Otimizações específicas para deploy
|
||||
modulePreload: {
|
||||
polyfill: false // Reduz o bundle size
|
||||
}
|
||||
},
|
||||
|
||||
// Otimizações de desenvolvimento
|
||||
server: {
|
||||
hmr: {
|
||||
overlay: false // Reduz ruído visual durante desenvolvimento
|
||||
},
|
||||
// Configurações de performance
|
||||
fs: {
|
||||
strict: false
|
||||
}
|
||||
host: true,
|
||||
port: 5173,
|
||||
},
|
||||
|
||||
// Configurações de preview otimizadas
|
||||
@@ -103,18 +59,6 @@ export default defineConfig(({ command, mode }) => {
|
||||
|
||||
plugins: [
|
||||
react(),
|
||||
tsconfigPaths(),
|
||||
tailwindcss(),
|
||||
],
|
||||
|
||||
// Configuração para ignorar erros de TypeScript no build
|
||||
esbuild: {
|
||||
logOverride: { 'this-is-undefined-in-esm': 'silent' },
|
||||
...(isProd && {
|
||||
drop: ['console', 'debugger'],
|
||||
minifyIdentifiers: true,
|
||||
minifySyntax: true,
|
||||
minifyWhitespace: true,
|
||||
}),
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user