Lighthouse performance improvement#238
Open
Brenont wants to merge 2 commits into
Open
Conversation
Member
|
Nice man, so tem um detalhe, testando aqui as fontes nao foram aplicadas nos componentes. Acredito que deve precisar de algum ajuste |
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.
ISSUE: -
Description
Improved mobile Lighthouse performance score from 71 → 89 (+18) by eliminating two render/bandwidth bottlenecks on the homepage:
next/font/google— replaced four render-blocking<link>tags tofonts.googleapis.comin_document.tsxand one@import url(...)inglobals.csswithnext/font/google(Open_Sans,Ubuntu).Ubuntu Monowas loaded but unused in the codebase, so it was droppedentirely. CSS variables (
--font-open-sans,--font-ubuntu) wire into the existing--font-sans/--font-displaydesign tokens so no consumer codechanges.
loading="lazy" decoding="async"to three large raw<img>tags inStudentProfileandModalities(
perfil-aluno-bg.webp,impulso.png,estartando.png— ~1 MB combined). These were downloading eagerly in parallel with the LCP banner and starving itof bandwidth under slow-4G throttling, despite the banner already having
priority.Median-of-3 Lighthouse results (mobile, headless Chrome 148, default-mobile throttling):
Dev Notes
next/legacy/imagew/priority, Cloudinary loader) was not the root cause — it was already prioritized. The cost wasbandwidth contention from non-LCP raw
<img>tags. The biggest single win came from lazy-loading two components below the fold, not from touching the LCPelement itself.
mobile DPR, consider migrating off
next/legacy/imageto the modernnext/image, evaluate explicit preload).next/fontrequires the variables to be applied to a DOM ancestor — wrapped<Component />in a<div>in_app.tsxcarrying`${openSans.variable} ${ubuntu.variable}`.Testing
Steps
yarn build && yarn starthttp://localhost:3000/in Chrome DevTools → Network: confirm no requests tofonts.googleapis.comorfonts.gstatic.com; fonts are served from/_next/static/media/*.woff2.perfil-aluno-bg.webpshould only download as it approaches the viewport (Network → filterImg).
impulso.pngandestartando.pngshould similarly load on demand..font-displayheadings) render correctly across the homepage, Header CTAs, subscriber pages, andmodals (
ConfirmationModal,ErrorModal,RequirementsModal)./and confirm score ≥ 85.display: 'swap'is set; CLS should stay at 0).Screenshots / Videos
All tests are local performed running local server by
yarn run build && yarn run startand Lighthouse on Google Chrome Devtolls in a incognito windowBefore (Main Branch)
Desktop
Mobile
After Changes
Desktop
Mobile
Developer Checks