ReferenceError: window is not defined in Server side rendering
See original GitHub issueHi Using the library, When try to build the application, which has both server side rendering as well as client side rendering, got the following issue.
…\node_modules\react-router-last-location\dist\index.js:10 [1] })(window, function(WEBPACK_EXTERNAL_MODULE__0, WEBPACK_EXTERNAL_MODULE__1, WEBPACK_EXTERNAL_MODULE__6) { [1] ^ [1] ReferenceError: window is not defined
Kindly add the following check in index.js => typeof window != "undefined" ? window : ''
So that it will work without any issues in ssr based application.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
React JS Server side issue - window not found - Stack Overflow
BROWSER to my advantage because it will be defined as undefined if it is server side, and it will be true if the...
Read more >How to solve Next.js window is not defined
Solve a the common ReferenceError: next.js window is not defined error that you may see when doing SSR & pre-rendering.
Read more >How to solve "window is not defined" errors in React and Next.js
Because in the Node.js world, window is not defined, window is only available in browsers. There are three ways to solve that: 1....
Read more >Using window in React SSR: The Complete Guide
window is not defined on the server, so you can't use it during the render of a component being SSR'd. ... During a...
Read more >referenceerror: window is not defined, how to solve
Here's how to fix the “referenceerror: window is not defined” error that you might have in Node.js or with a tool like Next.js....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@hinok Have verified, now it’s working fine. Thanks for the immediate fix.
I will release fixed version today evening (my local time - Warsaw, PL).