page.js
page.js copied to clipboard
window is undefined
I have the following code:
console.log(window)
page(encodeURI(path), state, dispatch, push)
As you can see, the console log shows window is an object, yet the page transition fails.
It happens in this line of code: this.title = (hasDocument && window.document.title);
Any idea why the window might be undefined? (This is in the browser, not SSR.)
Thanks!
Reading through the source code, I found that the window property can be set using the configure
method. Try this:
page.configure({window:window})
(not sure why this would be required to set manually)
I ran into this as well...why in the world do we have to set page.configure({window:window}) to make this library work?
@btknorr PRs welcome
had the same problem, got the error
Cannot read property 'document' of undefined
thanks, @kjantzer