Suggestion: Add an Attribute to Disable Script Preloading in NextJS #66297
Unanswered
stefa98
asked this question in
App Router
Replies: 1 comment
-
I have the same problem. At the moment, the only way is to use lazyOnload |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello everyone,
I hope you are doing well. Recently, I encountered the issue of inserting scripts within NextJS. After running various tests, I found that when using the “afterInteraction” strategy, NextJS inserts the resource among the preloads in the page head.
https://nextjs.org/docs/app/building-your-application/optimizing/scripts
Now, this is great for internal resources or external layout scripts, but in the case of using external scripts like ads, which you don't want to preload but still want to load after interaction, how should one proceed?
Wouldn't it be useful to add an attribute to the <Script> component that can disable resource preloading?
Thank you
Beta Was this translation helpful? Give feedback.
All reactions