feat(performance): bundle performance split – reduce main chunk by 43% - #18
feat(performance): bundle performance split – reduce main chunk by 43%#183scava1i3r wants to merge 4 commits into
Conversation
📝 WalkthroughWalkthroughUpdated Vite build config to add rollupOptions.output with manualChunks splitting vendor-react, vendor-query, and vendor-wallet and custom asset filename patterns. Dashboard page now lazy-loads ConnectWalletButton via React.lazy with a Suspense-wrapped WalletButtonSkeleton placeholder. CI workflow (.github/workflows/ci.yml) added pull_request trigger; deno-deploy workflow removed its pull_request trigger. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
src/components/dashboard-page.tsx (1)
13-15: Skeleton is fine, minor note on dimensions.Hardcoded
180px × 40pxcould mismatch the actual button size across viewports. Consider matching the real button's CSS class dimensions or usingmin-width/min-heightinstead. Low priority.
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
src/components/dashboard-page.tsx (1)
13-15: Consider addingaria-hiddenor a label to the skeleton.Screen readers will see an empty
div. Minor accessibility improvement:Proposed fix
- <div className="wallet-button skeleton" style={{ width: "180px", height: "40px" }} /> + <div className="wallet-button skeleton" style={{ width: "180px", height: "40px" }} aria-hidden="true" />
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
vite.config.ts (1)
24-37:node_modules/reactmatches more than justreact.
id.includes("node_modules/react")also matchesreact-is,react-router, etc. — any package whose name starts with "react". Consider tightening:Proposed fix
- if (id.includes("react") && (id.includes("node_modules/react") || id.includes("node_modules/react-dom"))) { + if (id.includes("node_modules/react/") || id.includes("node_modules/react-dom/")) {Also,
@reown/appkiton line 34 omits thenode_modules/prefix unlikewagmiandviem— inconsistent but functionally fine.
| push: | ||
| pull_request: |
There was a problem hiding this comment.
push + pull_request without branch filters → duplicate CI runs on every PR.
Both triggers fire when a PR branch is pushed. Consider scoping push to your default branch only:
Proposed fix
push:
+ branches: [main, development]
pull_request:📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| push: | |
| pull_request: | |
| push: | |
| branches: [main, development] | |
| pull_request: |
Summary
Reduced the main JS bundle size via code-splitting and vendor chunking while preserving all functionality. Fixes #7
Changes
Vite Configuration (
vite.config.ts)manualChunksconfiguration to split vendor libraries into separate chunks:vendor-react: React + React DOMvendor-query: @tanstack/react-queryvendor-wallet: wagmi + viem + @reown/appkitComponent Updates (
src/components/dashboard-page.tsx)ConnectWalletButtonusingReact.lazy()Suspensewrapper with skeleton fallback for smooth UXDocumentation (
BUNDLE_REPORT.md)Results
Validation
bun run build– Build successfulbun run dev– Dev server workingFuture Optimizations
The
vendor-walletchunk is still ~431 kB gzipped due to heavy wallet libraries. Future opportunities:Closes #7