next.js
98a73ead - Fix extensionless Google font URLs in both bundlers (#100158)

Commit
13 days ago
Fix extensionless Google font URLs in both bundlers (#100158) Fixes #99114 in both Turbopack and Webpack Due to Google Fonts dynamically returning the "best" font for the UA, it sometimes comes back as WOFF2 without an extension. We hardcode an extension expectation, so this fails: Webpack assumed every font URL ended in an extension, causing a null-regex crash. Turbopack split JSON options at embedded `&` characters. After that, its extension check would also fail The solution: For Webpack, remove the unsafe dereference, and resolve the extension from the CSS `format('XYZ')` hint when the URL lacks an extension For Turbopack, carry the resolved font extension from CSS extraction into asset emission instead of requiring a URL suffix. Also while investigating, Fleet found another bug: it parses the serialized options as a query string, so embedded `&` characters split the options before it ever reaches the extension check. To fix, we now percent-encode the entire JSON as one query entry, preserving the embedded params. --------- Co-authored-by: vercel-fleet-prod[bot] <318278635+vercel-fleet-prod[bot]@users.noreply.github.com> Co-authored-by: Andrew Imm <494043+andrewimm@users.noreply.github.com> Co-authored-by: Tobias Koppers <1365881+sokra@users.noreply.github.com>
Author
Parents
Loading