next 14 auto generated scripts async anc defer tags
Unanswered
American Wirehair posted this in #help-forum
American WirehairOP
Hey, next is automatically adding async tags to auto genrated scripts inside the head tag. I want to have defer tags on that scripts too. how can i modify it?
7 Replies
Barbary Lion
Can you be more clear? I dont understand your question.
American WirehairOP
in all next apps, there are auto generated script tags by next inside the head tag, which are basically the js code divided to chunks. they have async attribute by default, i want to add defer attribute to my scripts to make sure they are loaded after the html is parsed
Barbary Lion
As far as I know, you can only change that on custom scripts, not framework scripts itself because those are needed for hydration.
@Barbary Lion As far as I know, you can only change that on custom scripts, not framework scripts itself because those are needed for hydration.
American WirehairOP
i have seen some sites built with next, and have defer attr rather than async on their auto generated js chunks
Barbary Lion
Curious, why do you want to change it, it is managed by Nextjs for a reason, aren't you focussing on the wrong "perfectionist" things instead of building your application? 😅
@Barbary Lion Curious, why do you want to change it, it is managed by Nextjs for a reason, aren't you focussing on the wrong "perfectionist" things instead of building your application? 😅
American WirehairOP
actually, im trying to increase the performance score of my app for better seo. i've searched the best opponents on my sector which are built with next, and realized one major difference which is what I just told you 😅