Perf: cut initial JS to lift Lighthouse out of orange - #33
Merged
Conversation
Lighthouse mobile sat at 74-85 across regions with TBT 473-930ms. Three non-architectural config changes that target the dominant audits: - browserslist narrowed to modern evergreen browsers so SWC stops shipping legacy JS transforms and polyfills to everyone. Resolves the two "Legacy JavaScript" audit findings directly. - experimental.optimizePackageImports enables the compile-time transform for @mui/material, @mui/icons-material, and motion. Per-path imports alone don't stop MUI from dragging in internal modules; this does. - LiveOpsConsole is now lazy (next/dynamic, ssr:false). It's a debug surface, not critical path, so keeping it out of the initial bundle frees main-thread time before interactive. Verified: typecheck, 326/326 unit tests, production build, and 9/9 Playwright specs (including the LiveOpsConsole Cmd+Shift+D spec) all pass unchanged. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 20d739a. Configure here.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Lighthouse mobile scored 74–85 across regions with TBT 473–930 ms and LCP up to 3.2 s. Every failing audit mapped to two root causes (legacy JS polyfills + unused/slow JS on the main thread), so this PR is three config-only changes that target them directly. No architectural changes.
browserslistnarrowed to modern evergreen browsers (last 2 versions of Chrome/FF/Safari/Edge). Stops SWC from emitting legacy transforms/polyfills to everyone, which resolves both "Legacy JavaScript" audit findings outright.experimental.optimizePackageImportsinnext.config.tsfor@mui/material,@mui/icons-material, andmotion. Per-path imports alone (@mui/material/Box) don't stop MUI from dragging in internal modules — this compile-time transform does.LiveOpsConsoleis nownext/dynamicwithssr: false. It's a debug surface, not critical path. Splitting it frees main-thread time before interactive.Expected impact
Score: 74–85 → 88–95. TBT should drop below ~300 ms. LCP should improve 300–500 ms as the main thread frees up sooner. CLS was already 0 and stays that way.
Test plan
pnpm typecheck— cleanpnpm test— 326/326 pass (52 files)pnpm build— compiles;optimizePackageImportsconfirmed active in build logpnpm exec playwright test— 9/9 pass, incl. theLive Ops Console opens on Cmd+Shift+Dspec that exercises the now-dynamic component🤖 Generated with Claude Code
Note
Medium Risk
Changes build-time transpilation and import optimization settings, which can impact bundle output and browser compatibility if assumptions about supported browsers or package export shapes are wrong.
Overview
Improves initial load performance by code-splitting the debug-only
LiveOpsConsolebehindnext/dynamic(client-only) so it no longer ships in the first JS chunk forMyActivityClient.Updates Next.js config to enable
experimental.optimizePackageImportsfor MUI andmotion, and adds a modern evergreenbrowserslistinpackage.jsonto reduce legacy transforms/polyfills in generated client bundles.Reviewed by Cursor Bugbot for commit 20d739a. Bugbot is set up for automated code reviews on this repo. Configure here.