Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,15 @@ export default defineConfig({
rollupOptions: {
output: {
manualChunks: (id) => {
// Only bundle Three.js when PreviewComponent is loaded
if (id.includes('node_modules/three/')) {
return 'three-core';
}
if (id.includes('@react-three/')) {
return 'react-three';
}
// Separate vendor chunks for better caching
if (id.includes('node_modules/react') || id.includes('node_modules/react-dom') || id.includes('node_modules/react-router')) {
return 'react-vendor';
}
// Keep Three.js separate but don't split @react-three packages
// They need to stay with the component that uses them to avoid dependency issues
if (id.includes('node_modules/three/') && !id.includes('@react-three')) {
Copy link

Copilot AI Oct 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The condition !id.includes('@react-three') will incorrectly exclude paths like node_modules/three/examples/jsm/... if they happen to contain the string '@react-three' anywhere in the full path (e.g., in a parent directory name). Use a more precise check like !id.includes('node_modules/@react-three') to ensure you're only excluding the @react-three packages and not legitimate three.js files.

Suggested change
if (id.includes('node_modules/three/') && !id.includes('@react-three')) {
if (id.includes('node_modules/three/') && !id.includes('node_modules/@react-three')) {

Copilot uses AI. Check for mistakes.
return 'three-core';
}
if (id.includes('@headlessui') || id.includes('@heroicons') || id.includes('react-hot-toast')) {
return 'ui-vendor';
}
Expand Down