How to fix link preload warning in Next.js app? #49607
Replies: 118 comments 211 replies
-
Any fix to this ?? I am also getting the same issue |
Beta Was this translation helpful? Give feedback.
-
Still dealing with the issue. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
same issue here in next.js version 14.2.0 |
Beta Was this translation helpful? Give feedback.
-
This error is coming in production or not? |
Beta Was this translation helpful? Give feedback.
-
I'm having the same error and I'm only with Footer component :/ I'm not done with the whole website |
Beta Was this translation helpful? Give feedback.
-
This issue actually coming from the next/font/google component. According to the warning preloaded link must have the appropriate as property whether this is a style or script link. I hope the next.js team will provide the solution soon :) |
Beta Was this translation helpful? Give feedback.
-
I thought it was a font issue so I removed const inter = Inter({ subsets: ['latin'] }); But still same warning. I also noticed that I loads a bunch of duplicate stylesheets, each warning adds another stylesheet to frame(see image). There is no warning once deployed on Vercel though. |
Beta Was this translation helpful? Give feedback.
-
The warning is given by the preloading of CSS modules through the Link component. |
Beta Was this translation helpful? Give feedback.
-
same issue here in next.js version 13.4.3 |
Beta Was this translation helpful? Give feedback.
-
had the same issue, removed path alias import and the warning went away somehow. // import "@/globals.css"
import "../../globals.css" |
Beta Was this translation helpful? Give feedback.
-
I have got the same problem with Next v.13.4.1. It's "REALLY ANNOYING" for debugging in DevTool. The error in the the DevTool said that the link suppose to have "as" property in the CSS styles tag from the tag. But as we can see on my picture Next.js generate link Stylesheet but not include "as" property. There is the error. I have done as Documentation said to import CSS Module like this image but error still show up: Are this a bug from App Directory? Because when I use Page Directory before this error is not happened. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
If the preload warnings related to the next/font/google component are ruining your day, you can try the CSS variable approach to font handling as described in the section regarding Using Multiple Fonts in the NextJS Font Optimization docs. Worked for me. See the code examples under the paragraph that begins with Alternatively, you can create a CSS variable... |
Beta Was this translation helpful? Give feedback.
-
Still testing but it seems to have worked for me. 1- In the import { Inter } from "next/font/google";
export const inter = Inter({
subsets: ["latin"],
display: "swap",
}); In the "use client";
import "./global.css";
import AuthContext from "./lib/authContext";
// aqui eu importei a font que quero usar, inclusive com esse método posso usar utras fontes em outras partes da mesma forma
// here I imported the font I want to use, even with this method I can use other fonts in other parts in the same way
import { inter } from "@/app/styles/fonts";
export interface RootLayoutProps {
children: React.ReactNode;
}
export default function RootLayout({ children }: RootLayoutProps) {
return (
<html>
<body className={inter.className}> //normal use in className - uso normal no className
<AuthContext>{children}</AuthContext>
</body>
</html>
);
} Espero que ajude, pra mim está funcionando / I hope this helps, it's working for me |
Beta Was this translation helpful? Give feedback.
-
Still the same in 2025 |
Beta Was this translation helpful? Give feedback.
-
Found a solution, maybe like this: before
after
|
Beta Was this translation helpful? Give feedback.
-
I get this warning after saving a file (Ctrl + S) while editing css files because of how Hot Module Replacement (HMR) works in Next.js. When you save changes to a CSS file, HMR updates the styles without reloading the entire page. However, this may cause a momentary loss of synchronization between the browser and the applied styles, causing the browser to generate a warning. |
Beta Was this translation helpful? Give feedback.
-
It is like an HTTP response for the page add a Link header to preload the first two pictures in nextjs 15. console warring
source code:
HTTP response header
HTML result
|
Beta Was this translation helpful? Give feedback.
-
I have the same problem here, but with a different file.
|
Beta Was this translation helpful? Give feedback.
-
I think I found the reason. Next JS prefetch all the Link tag href linked page css unless you prefetch={false}. I have found this through Chrome dev mode screen size change. If screen height = 0 there is no prefetch issue, but when you increase the screen size and on screen catches the Link tag it prefetch. Hope this helps |
Beta Was this translation helpful? Give feedback.
-
This problem has been occurring in my app ever since I upgraded Next.js from version 14.2.6 to 15.3.2, but only in production. I have tried all the proposed fixes from that thread, and nothing seems to work for me. Here is the warning on chrome :
And the same in Firefox :
package.json
(global)/layout.tsx
|
Beta Was this translation helpful? Give feedback.
-
. |
Beta Was this translation helpful? Give feedback.
-
. |
Beta Was this translation helpful? Give feedback.
-
still same issue in 08,2025 |
Beta Was this translation helpful? Give feedback.
-
This is tricky. |
Beta Was this translation helpful? Give feedback.
-
still dont know the fixes. i already set preload: false to all font on local but the prod still have same warning PROD![]() Local![]() |
Beta Was this translation helpful? Give feedback.
-
temporary fix: rolling back to nextjs 14.2.4 is the fix for me |
Beta Was this translation helpful? Give feedback.
-
. |
Beta Was this translation helpful? Give feedback.
-
Context
Cause
Fix (minimum viable)
Notes
If this solves it, please Mark as answer so others can find it. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
I am developing a Next.js app with version 13.4 and I am getting this warning in the console:
The resource <URL> was preloaded using link preload but not used within a few seconds from the window’s load event. Please make sure it has an appropriate as value and it is preloaded intentionally.
The number of the error is increasing.
Additional information
No response
Example
No response
Beta Was this translation helpful? Give feedback.
All reactions