Skip to content

⚡️ Configure bundle chunking for mermaid and increase size warning limit#44

Open
yuler wants to merge 2 commits intomainfrom
fix/chunk-size-warning-limit
Open

⚡️ Configure bundle chunking for mermaid and increase size warning limit#44
yuler wants to merge 2 commits intomainfrom
fix/chunk-size-warning-limit

Conversation

@yuler
Copy link
Copy Markdown
Owner

@yuler yuler commented Apr 14, 2026

Summary

  • Add manualChunks to split mermaid and its dependencies into a separate vendor-mermaid chunk
  • Increase chunkSizeWarningLimit to 3000KB to suppress warnings for the large mermaid bundle
  • Mermaid is loaded dynamically (via import('mermaid')) so it only loads when needed

Test plan

  • Build passes with no warnings
  • vendor-mermaid.js chunk is created (2.7MB)
  • Other chunks remain under 500KB

yuler and others added 2 commits April 14, 2026 09:49
Add manualChunks to split mermaid and its dependencies into a separate
vendor-mermaid chunk. Increase chunkSizeWarningLimit to 3000KB to suppress
warnings for the large mermaid bundle which is loaded dynamically.
github-actions Bot added a commit that referenced this pull request Apr 14, 2026
@github-actions
Copy link
Copy Markdown
Contributor

📸 Screenshots for PR #44
page iphone ipad pc
home home iphone home ipad home pc
posts posts iphone posts ipad posts pc
posts-hi posts-hi iphone posts-hi ipad posts-hi pc
workouts workouts iphone workouts ipad workouts pc
workouts-17883105335 workouts-17883105335 iphone workouts-17883105335 ipad workouts-17883105335 pc

PR screenshots folder (branch pr-screenshots)

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request updates the Astro configuration to include a custom build setup, increasing the chunk size warning limit and implementing manual chunking for Mermaid and its associated dependencies. A review comment suggests refactoring the chunking logic using an array-based approach for better maintainability and ensuring the core d3 package is correctly captured.

Comment thread astro.config.mjs
Comment on lines +46 to +55
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'
}
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'
              }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant