bankai
bankai copied to clipboard
Server Side Rendering Skipped due to error: window is not defined
I have a large app using choo.js and bankai. I'm trying to move from choo 6.0.0 to 6.13.0 & bankai 8.1.1 to 9.15.0 I'm getting the following error when running bankai build: node ./node_modules/bankai/bin.js build index.js
"Server Side Rendering Skipped due to error: window is not defined"
Does anyone have an idea why I'm getting this? everything is working, but wanted to know what is the problem...
for me, it was that I had a reference window
in my choo entry point. (even trying to wrap it in like if (window) {...}
)
this is such persistent issue for me - and clearly for others. I think this should be possible for bankai to handle automatically. Specifically I think it should be possible to make a browserify transform that detects calls to the browser-exclusive API and wraps them automatically in the necessary protection to allow server-side rendering.
Is there any reason not to do this?
Also - I really think this needs to be in the README. Bankai errors out with no obvious route to a solution on many of the standard browser libraries. @yoshuawuyts thoughts on documenting it until a better solution is in place?
edit - links to where others eloquently described the problem:
- https://github.com/choojs/bankai/issues/226#issuecomment-322948009
- https://github.com/choojs/bankai/issues/226#issuecomment-325221051
@blahah PRs to document this would be very welcome. Possibly its own section in the readme, or else as part of a FAQ.