Commit Graph

2 Commits

Author SHA1 Message Date
Norcleeh 98fd69cc6f fix(font): not emitting 400 as default value when font weight is omitted (#2796) 2026-08-13 20:14:07 +01:00
Andrew 8ab7a663f6 fix(fonts): keep immutable font assets query-free (#2605)
* fix(fonts): don't append ?dpl= to font preload hrefs

The @font-face src URLs (inline style block and built CSS) are emitted
bare, and a preload only matches a font request when the URLs are
byte-identical. Appending the deployment-id query to the preload hrefs
made every font preload a wasted download and re-fetched each font a
second time once the CSS parsed — measurably late, inside the LCP
window. Font files are content-hashed, so the query added no
cache-busting value.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* fix(fonts): drop ?dpl= from Pages Router font preloads

The Pages Router had the same bug fixed for the App Router in the
previous commit, in two places: buildPagesFontHeadHtml wrapped the HTML
<link rel="preload"> hrefs in appendAssetDeploymentIdQuery, and the
pages handler's HTTP Link: header did the same — while the @font-face
src URLs in the <style data-vinext-fonts> block are emitted bare. A
preload only matches a font request when the URLs are byte-identical,
so every Pages font preload was a wasted download. Fonts are
content-hashed, so ?dpl= added no cache-busting value.

Adds a Pages Router production test (new pages fixture with
next/font/google) pinning a deploymentId and asserting both the HTML
preload hrefs and the Link: header URLs are query-free and
byte-identical to the @font-face src URLs.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* fix(fonts): preserve deployment IDs across font URLs

* fix(fonts): keep immutable font assets query-free

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: James <james@eli.cx>
2026-07-20 23:01:29 +01:00