You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Until next@14.0.5-canary.20, typeof window returned undefined inside a webworker as expected. However since next@14.0.5-canary.20, typeof window returns object but this object cannot be accessed. Therefore, as it stands, third party libraries making use of window via an undefined test cannot work anymore in webworkers in Nextjs.
The most notable example if Three.js which includes this snippet at the end of the library -
if(typeofwindow!=='undefined'){if(window.__THREE__){console.warn('WARNING: Multiple instances of Three.js being imported.');}else{window.__THREE__=REVISION;}}
Provide environment information
All
Which area(s) are affected? (Select all that apply)
SWC transpilation
Which stage(s) are affected? (Select all that apply)
next dev (local), next build (local), next start (local), Other (Deployed)
Additional context
This bug was first introduced in next@14.0.5-canary.20
The text was updated successfully, but these errors were encountered:
Link to the code that reproduces this issue
https://codesandbox.io/p/devbox/boring-hill-2w8x38?file=%2Fapp%2Fworker.ts%3A5%2C44
To Reproduce
Current vs. Expected behavior
Until next@14.0.5-canary.20,
typeof window
returnedundefined
inside a webworker as expected. However since next@14.0.5-canary.20,typeof window
returnsobject
but this object cannot be accessed. Therefore, as it stands, third party libraries making use ofwindow
via anundefined
test cannot work anymore in webworkers in Nextjs.The most notable example if Three.js which includes this snippet at the end of the library -
Provide environment information
Which area(s) are affected? (Select all that apply)
SWC transpilation
Which stage(s) are affected? (Select all that apply)
next dev (local), next build (local), next start (local), Other (Deployed)
Additional context
This bug was first introduced in next@14.0.5-canary.20
The text was updated successfully, but these errors were encountered: