Skip to content
Open
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
24 changes: 24 additions & 0 deletions astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,29 @@ export default defineConfig({
'@': path.resolve(__dirname, 'src'),
},
},
build: {
chunkSizeWarningLimit: 3000,
rollupOptions: {
output: {
manualChunks(id) {
// Create vendor chunks for large dependencies
if (id.includes('node_modules')) {
// Mermaid and its dependencies
if (id.includes('mermaid')
|| id.includes('cytoscape')
|| id.includes('dagre')
|| id.includes('khroma')
|| id.includes('dayjs')
|| id.includes('uuid')
|| id.includes('lodash')
|| id.includes('d3-')) {
return 'vendor-mermaid'
}
Comment on lines +46 to +55
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The manual chunking logic can be simplified and made more robust. Using an array with .some() improves readability and maintainability. Additionally, changing d3- to d3 ensures the core d3 package is also captured if it's imported directly, rather than just the sub-packages (like d3-selection).

              const mermaidVendors = ['mermaid', 'cytoscape', 'dagre', 'khroma', 'dayjs', 'uuid', 'lodash', 'd3']
              if (mermaidVendors.some(v => id.includes(v))) {
                return 'vendor-mermaid'
              }

// Other vendors can be grouped here if needed
}
},
},
},
},
},
})