Closed wlhtck closed 2 years ago
IMHO it is not a bug of Next.js. Because not only data-nscript
but any extra attributes (type="application/javascript"
, or type="text/javascript"
, or language="javascript"
, or charset="UTF-8"
) will throw the error as well:
<!-- All of examples below will cause the error -->
<script type="application/javascript" src="..."></script>
<script type="text/javascript" src="..."></script>
<script language="javascript" src="..."></script>
<script charset="UTF-8" src="..."></script>
You should report the bug to the vendor instead.
Agreed, thanks for looking at this @SukkaW 👏
This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.
Verify canary release
Provide environment information
What browser are you using? (if relevant)
No response
How are you deploying your application? (if relevant)
Other Platform
Describe the Bug
As of Next12 it looks like NextJS is adding a data attribute (
data-nscript
) to scripts rendered by the built in Script Tag. This behavior breaks a key third script in our application which uses data attributes for configuring and therefore prevents upgrading from Next11 to Next12. As far as I can tell this behavior is undocumented and not possible to control. Please see the attached screen shots for the impact of this data attribute for our use case:Expected Behavior
I'm not entirely sure why NextJS is adding this data attribute, but it would be helpful if we could somehow opt out of it.
To Reproduce
Use the
Script
tag in Next12 or later. Note thedata-nscript
attribute that is added to the DOM.