perf(website): Lazy-load Ace editor via dynamic import#1587
Conversation
`TryItResultContent.vue` pulls in `ace-builds` and `vue3-ace-editor`, which add ~480 KB of JS that the landing page does not need until the user actually packs a repository. Wrapping the import with `defineAsyncComponent` moves that work into a separately fetched chunk, trimming the initial bundle and improving LCP/INP on the homepage. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughTryItResultContent component import is converted from static to lazy-loaded. The import statement now uses ChangesLazy-load TryItResultContent component
Estimated code review effort🎯 2 (Simple) | ⏱️ ~5 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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.
Code Review
This pull request optimizes the TryItResult.vue component by converting the TryItResultContent import into an asynchronous component using defineAsyncComponent to reduce the initial bundle size. The reviewer suggested enhancing this implementation by using the object syntax for defineAsyncComponent to include a loading component and error handling, which addresses potential UI gaps during the asynchronous loading of the heavy Ace editor dependencies.
⚡ Performance Benchmark
Details
History981cfeb perf(website): Lazy-load Ace editor via dynamic import
|
Claude ReviewClean, well-scoped change — verified end-to-end that DetailsRecommended (non-blocking)
Nit
Other notes
LGTM — safe to merge as-is. |
Use the object form of `defineAsyncComponent` so the chunk fetch shows `TryItLoading` after a short `delay` and surfaces a timeout instead of leaving the panel blank if the fetch stalls. Also annotate the inline comment with the rough chunk size (~480 KB) so future contributors think twice before re-static-importing. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Summary
TryItResultContent.vuewithdefineAsyncComponentinTryItResult.vuesoace-builds/vue3-ace-editor(~480 KB of JS) load on demand instead of as part of the landing-page bundle.Why
The Ace editor is only needed once the user has packed a repository, but it was previously imported statically and shipped with the initial bundle. Deferring it shrinks the homepage payload and improves Core Web Vitals (LCP/INP), particularly on mobile / low-bandwidth connections.
Verification
node --run docs:buildproduces a separateTryItResultContent.*.jschunk (~480 KB) confirming the editor is now split out.Checklist
node --run lint(website/client)node --run docs:build(website/client)