Commit Graph

4 Commits

Author SHA1 Message Date
Jude Gao 6c105133e7 Fix: CSS asset URLs broken with experimental.inlineCss (#85140)
This PR fixes a critical issue with the `experimental.inlineCss` feature
where CSS `url()` references to fonts and other assets would break when
CSS was inlined into `<style>` tags instead of being loaded via external
`<link>` tags. The problem occurred because relative URLs in CSS are
resolved relative to the CSS file's location when loaded externally, but
when the CSS is inlined directly into the HTML document, those same
relative URLs resolve relative to the HTML document instead, causing 404
errors for fonts and images. We fixed this by detecting when CSS is
being prepared for inlining and switching from relative URLs (like
`../_next/static/media/font.woff2`) to absolute URLs (like
`/_next/static/media/font.woff2`) in both the Webpack and Turbopack
bundlers. This ensures that asset references work correctly regardless
of whether the CSS is inlined or external, while maintaining the
existing optimization of using relative URLs for the default case where
CSS is loaded via external stylesheets. The fix is transparent to users
and requires no changes to application code—simply enabling
`experimental.inlineCss: true` will now work correctly with all CSS
asset references.


Fixes https://github.com/vercel/next.js/issues/83674

---------

Co-authored-by: Niklas Mischkulnig <4586894+mischnic@users.noreply.github.com>
2025-10-21 10:13:36 -07:00
Jude Gao 6fd6ed1ea2 Check cache busting search params on all RSC requests (#80669)
For all RSC requests, we require the `_rsc` search param to match the
hash of its corresponding RSC headers. In the case where the match
fails, we respond with a redirect to the correct search param. This hash
check only applies to `next start` mode for now.
2025-06-25 12:46:29 -04:00
Jude Gao a2f4b93b71 Do not inline CSS in RSC payload for dynamic client nav (#73182) 2024-11-25 19:54:38 -05:00
Jude Gao 4d76f9831d experimental: css inlining (#72195) 2024-11-20 17:03:40 -05:00