Closed housseindjirdeh closed 2 years ago
Any environment
No response
Embedding an inline script with next/script and the worker strategy shows a console error and the script is not executed in the web worker.
next/script
worker
Example:
<Script id="gtm" strategy="worker" dangerouslySetInnerHTML={{ __html: `(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); })(window,document,'script','dataLayer','GTM-******');`, }} />;
Error:
No error and that the script executes normally in the web worker.
experimental: { nextScriptWorkers: true }
next.config.js
<Script strategy="worker" ... />
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
Any environment
What browser are you using? (if relevant)
No response
How are you deploying your application? (if relevant)
No response
Describe the Bug
Embedding an inline script with
next/script
and theworker
strategy shows a console error and the script is not executed in the web worker.Example:
Error:
Expected Behavior
No error and that the script executes normally in the web worker.
To Reproduce
experimental: { nextScriptWorkers: true }
tonext.config.js
<Script strategy="worker" ... />