-
Notifications
You must be signed in to change notification settings - Fork 26.8k
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
Script component results in different attributes based on the strategy #33686
Comments
I've digged a bit in the source code and I think this is because getPreNextScripts. Some attributes are forwarded but |
For https://nextjs.org/docs/messages/doc-crossorigin-deprecated I'm not sure why this warning does not show up in development: next.js/packages/next/pages/_document.tsx Line 828 in fd1c56e
Although it talks about I believe |
Oh didn't see that, thanks for the feedback (maybe the warning it's not showing up because with the Script component that code I'm not sure it's executed) |
Do not add <script> tags using next/head (see inline <script>). Use next/script instead. See more info here: https://nextjs.org/docs/messages/no-script-tags-in-head-component Sadly this breaks a test because of vercel/next.js#33686
Hi! I am also having this issue after moving from a standard Thanks! |
@4lejandrito do note that you don't have to put
https://nextjs.org/docs/basic-features/script See also: https://nextjs.org/docs/messages/no-script-tags-in-head-component#script-component |
Hi @balazsorban44, I did remove |
@4lejandrito I don't think @balazsorban44 meant that removing from the head would have fixed the Not sure if there are news about |
Actually still unsure about both I asked @janicklas-ralph to have a look, he might be able to provide more context here. 👍 |
Small update here, |
That's great to hear, thanks @balazsorban44 |
Hi guys, any updates on the |
Do not add <script> tags using next/head (see inline <script>). Use next/script instead. See more info here: https://nextjs.org/docs/messages/no-script-tags-in-head-component Sadly this breaks a test because of vercel/next.js#33686
Do not add <script> tags using next/head (see inline <script>). Use next/script instead. See more info here: https://nextjs.org/docs/messages/no-script-tags-in-head-component Sadly this breaks a test because of vercel/next.js#33686
The |
Run
next info
(available from version 12.0.8 and up)next info output:
What version of Next.js are you using?
12.0.8
What version of Node.js are you using?
16.13.0
What browser are you using?
Chrome
What operating system are you using?
macOS
How are you deploying your application?
next start
Describe the Bug
I premise that I am not sure it is a problem, however I have not found this behavior documented anywhere.
I'm using the Script component and I'm seeing some differences when setting the strategy to
beforeInteractive
compared to other strategies.The main difference I'm seeing is on the
defer
andcrossorigin
attributes. I setcorssorigin=anonymous
anddefer=false
in some of our scripts.Setting
beforeInteractive
strategy the ending DOM element always has the defer attribute (no matter what I pass to the component) and the crossorigin is ignored.Examples:
with code like this
the output is
with code like this
the output is
Expected Behavior
defer
andcrossorigin
attributes are not changed based on strategyTo Reproduce
I created a repository to reproduce it easily.
Just clone it,
npm run dev
, and open localhost:3000In the console two scripts are being printed, the two have the same attributes except for the strategy.
The text was updated successfully, but these errors were encountered: