Open
Description
Issue
I recently discovered an issue with my Next Env Variables, where it seems only SSR Components are able to access runtime variables.
After some debugging, it seems although the issue is coming from the <Script/>
component from Next.
<Script id={"test"} strategy={"beforeInteractive"} dangerouslySetInnerHTML={{__html: `console.log('test', window); window['__ENV'] = 'test'; console.log(window);`}}/>
The above code will fail due to the beforeInteractive
strategy. If it's set to afterInteractive
the window will be updated as expected.
It seems although beforeInteractive
causes the script to not run at all in the client.
Anyone else ever encountered a similar issue?
Metadata
Metadata
Assignees
Labels
No labels