-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
ReferenceError: window is not defined #1987
Comments
PRs are welcome. We already have |
Looks like the issue is coming from this commit: e350886 Perhaps we should wrap the defaultProps "context": window with an "isBrowser" check |
+1 ChrisNLott thanks for help! I commented all changes from this commit (+two related comments in Sticky.js and Visibility.js) and my project start to work. Hope it can help somebody) |
Thank @ilinyevg, I try this and it work ! const hasWindow =
typeof window === 'object' && window !== null && window.self === window;
Visibility.defaultProps = {
context: hasWindow ? window : {},
continuous: false,
once: true
}; |
I have wrote temporary script for fix this, perhaps for somebody will be useful
|
How's this going? Everything broke here :( |
Falling back to 0.71.3 should be fine until this is fixed. |
I'm in a loop xD I'll try the workarounds |
I'm getting an error related to "window is not defined" when deploying to gatsby. I see multiple issues about this here and lots of discussion. Is there any consensus regarding a solution? if so should we add something to the docs? |
Just wait until #1990 will be merged and released in new version. |
@layershifter Any eta on when project maintainers are planning to do so? |
I do my best to make a release every weekend. Sometimes I don't cause of life and free software :) |
I still have this error in 0.72.0 scrollContext: typeof window === 'object' && window !== null && window.self === window ? window : {}, The code above fixed problem |
node V7.9.0 |
If users are having issues on the latest release, please open a new issue if there is not one already. The fields in the issue template are necessary for us to debug and ship fixes. |
Experiencing this error with SSR on version |
I add to webpack on the server side the following plugin: plugins: [
// Define free variables
// https://webpack.js.org/plugins/define-plugin/
new webpack.DefinePlugin({
window: undefined,
}),
], |
We're happy to look at new issues posted against the latest version |
From the latest version: 0.71.5, server-side rendering produces following issue
The text was updated successfully, but these errors were encountered: