-
Notifications
You must be signed in to change notification settings - Fork 47.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug: link order been messed up after upgrade to next version #26705
Comments
the link order is important cause we want to preload some critical image to decrease the LCP time |
downgrade the version to 18.2.0, and the order is expected. |
Hi @lili21 , i am new to open source could i get a chance to work on this issue? |
When you say "messed up" do you mean some tags or missing? Or can you be more specific? |
the order of links is not expected. |
those |
it's hurting our performance. you can check the similar problem with vitejs/vite#5120. after upgrade to react@canary version, we see the same effect in production, the FCP increase about 1s. because all the |
@gaearon I think modulepreloads should ideally be moved to after the last stylesheet link tag, which would let the browser fetch the blocking CSS as fast as possible before attempting to preload any JS modules, which can occur asynchronously and won't block the initial paint. |
Ideally React fixes this by automatically prioritizing stylesheets over modulepreloads and a workaround isn't needed. However to move the stylesheets above the modulepreloads in the meantime, you can add a e.g. export const links: LinksFunction = () => [
{ rel: 'stylesheet', href: appStylesHref, precedence: 'high' },
]; Will result in the stylesheet link being placed at the top of the head element, above the modulepreloads. <head>
<meta charSet="utf-8"/>
<meta name="viewport" content="width=device-width,initial-scale=1"/>
<link rel="stylesheet" href="/build/_assets/app-B5PUCUEH.css" data-precedence="high"/>
<title>New Remix App</title>
<meta name="description" content="Welcome to Remix!"/>
<link rel="modulepreload" href="/build/entry.client-4MXBZIKC.js"/>
<link rel="modulepreload" href="/build/_shared/chunk-PNG5AS42.js"/>
<link rel="modulepreload" href="/build/root-XKG6C447.js"/>
<link rel="modulepreload" href="/build/routes/_index-T377ZUPD.js"/>
</head> |
This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment! |
Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please create a new issue with up-to-date information. Thank you! |
the link order inside head element has been messed up after upgrade to next version
React version: 18.3.0-next-c8369527e-20230420
Steps To Reproduce
Link to code example:
https://github.com/lili21/remix-react_next
The current behavior
the link order is
The expected behavior
the link order should be
The text was updated successfully, but these errors were encountered: