SSR support on v5.0.0
See original GitHub issueUsing react-image-lightbox@5.0.0
on non-browser env(e.g. SSR) throws window is not defined
error:
ReferenceError: window is not defined
at Object.<anonymous> (/Users/nnishimura/works/git/my-repo/node_modules/react-image-lightbox/dist/main.js:3:3)
https://cdn.jsdelivr.net/npm/react-image-lightbox@5.0.0/dist/main.js
This is due to webpack issue, https://github.com/webpack/webpack/issues/6522
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
SSR (additional components)
next-i18next@v5.0.0 supports Next.js v9.5 in Serverless mode (as of July 2020). If your goal is to use earlier versions of Next.js with Serverless, ......
Read more >Server-side rendering broken after upgrading to MUI 5 ...
I migrated my server-side rendering (SSR) working app to version 5 of MUI. ... run codemod (v5.0.0/preset-safe and link-underline-hover) ...
Read more >Migrating to v5: getting started - Material UI - MUI
Additionally, v5 is the only version that fully supports React 18, ... update your packages to at least v4.11.2 for Material UI and...
Read more >Can't create UMD build which can be required by Node
Node v8.9.4, webpack v4.0.0-beta.2 ... SSR support on v5.0.0 frontend-collective/react-image-lightbox#118.
Read more >Simple Server Side Rendering, Routing, and Page ...
... my machine reverted to using Node v5.0.0. Which doesn't support various declarations found in the Nuxt/Starter codebase.
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
If you want use the latest version with SSR you can do something like this:
@Arrvin this issue only happens when you are using the latest version of
react-image-lightbox
(v5.0.0). So if you are on SSR app, you need to use v4.6.0 or below for now. Or you can wait for the next version which will have the fix 👍