Skip to content

Instantly share code, notes, and snippets.

@ccthecode
Created February 5, 2025 00:15
Show Gist options
  • Save ccthecode/5d5c9cb57f93fe6463a516f57ab65f31 to your computer and use it in GitHub Desktop.
Save ccthecode/5d5c9cb57f93fe6463a516f57ab65f31 to your computer and use it in GitHub Desktop.
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
optimizeDeps: {
exclude: ['lucide-react'],
},
build: {
chunkSizeWarningLimit: 1800,
rollupOptions: {
output: {
manualChunks(id: string) {
if (id.indexOf('node_modules') !== -1) {
const basic = id.toString().split('node_modules/')[1];
const sub1 = basic.split('/')[0];
if (sub1 !== '.pnpm') {
return sub1.toString();
}
const name2 = basic.split('/')[1];
return name2.split('@')[name2[0] === '@' ? 1 : 0].toString();
}
}
}
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment