-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
document is not defined
related to CustomEvents
#226
Comments
Off the top of my head it looks like something that shouldn't be running on the server is running on the serve hence the document & window issues. Are you trying to do server side rendering? Does bankai even support that? |
No, I'm not, just a basic create choo app |
Bankai does server rendering out of the box now; hence this code failing. Should check with |
The featured choo example fails with bankai 9 because of this. If we expect people to check for window, we should add that to the example me thinks. That or we handle this inside of choo.mount. |
Yeah I wasn't calling that function; I just did create-choo-app. I think it's being thrown by one of the deps? Regarding SSR being enabled by default, is that relevant to people using bankai as a dev server, or is it an optimisation? I've personally not had to use SSR yet. I wouldn't mind getting it as a free bonus, but it also means I don't consider the implications of window being absent when I'm just throwing a basic UI together. So I wonder how we'd make that more clear, perhaps in the errors, or maybe make it so that if SSR fails the client code still runs rather than the whole app dying? |
So it looks like the The first screenshot, though, dealt with choo-reload. I'll try to reproduce it again. |
I spent the last couple of hours trying to debug an issue which I think is related to this ticket, but I'm not using I did a fresh var choo = require('choo')
var html = require('choo/html')
var app = choo()
app.route('/', hello)
document.body.appendChild(app.start()
function hello (state, emit) {
return html`<div>Hello world</div>`
}
var choo = require('choo')
var html = require('choo/html')
var app = choo()
app.route('/', hello)
if (typeof window !== 'undefined') {
document.body.appendChild(app.start())
}
function hello (state, emit) {
return html`<div>Hello world</div>`
} Note: the same issue with the same fix will occur if you're using This code now works, but I'm still very confused as to why there has to be a Is there a dependency that both This has me concerned because if you don't do a |
I'm experiencing an odd issue... after a while of running my bankai server (generated by
create-choo-app
version^9.0.0-1
), I stopped it, and now I can't start it back up.First, I got an error about
window
not being defined in the context ofwindow.EventSource('sse')
.Recognising this as part of
choo-reload
, I disabled that plugin. Now I'm getting an error aboutdocument
not being defined in the context ofdocument.createEvent
.I've tried removing a bunch of my code, and reinstalling all dependencies, and I'm still getting the issue. Any idea why?
The text was updated successfully, but these errors were encountered: