loaders.gl
loaders.gl copied to clipboard
[@loaders.gl/video] window is not undefined error
Removing this safe guard for window in the .ts rewrite introduced a bug in server side rendering when upgrading past version v3.1.0-alpha.5, since the module is accessing window and it is not defined.
Last working stable version appears to be 3.0.12
@hkim8567 reported an error today from his next.js logs after a minor package upgrade:
error - ReferenceError: window is not defined
ReferenceError: window is not defined
at Object.<anonymous> (***/node_modules/@loaders.gl/video/dist/es5/lib/gifshot/gifshot.js:8:8)
This traces back to this code: URL: window.URL || window.webkitURL || window.mozURL || window.msURL,
Originally posted by @chrisgervang in https://github.com/visgl/loaders.gl/pull/1930#discussion_r860111045
Current workaround in package.json:
"resolutions": {
"@loaders.gl/video": "3.0.12"
}
Perhaps just replace window with globalThis?
Included in v3.2.5