Does not work with SSR
See original GitHub issueI get a “ReferenceError: window is not defined” when I try to import PWAPrompt from 'react-ios-pwa-prompt';
I believe this an issue with SSR in next.js. Is it possible to execute deviceCheck()
after the component has been mounted?
Thanks.
Issue Analytics
- State:
- Created 4 years ago
- Comments:11 (5 by maintainers)
Top Results From Across the Web
Next js app with SSR is not pre-rendering HTML, so web ...
Within the auth context file, I was performing conditional rendering, depending on a loading state, which was causing SSR not to take place:....
Read more >Does not work with SSR · Issue #217 · tajo/react-portal - GitHub
When running this code with SSR I am seeing this: Invariant Violation: Portals are not currently │ supported by the server renderer.
Read more >How to Disable Server-Side Rendering (SSR) in Next.js
Step 1: Rewrite All Requests to pages/index.js · Step 2: Disable SSR for Page Content · Step 3: Check that Everything Works with...
Read more >Inertia SSR does not work - Laracasts
I have setup new Laravel project with Breeze package + Inertia SSR support php artisan breeze:install vue --ssr I do everything according Inertia...
Read more >Server-side rendering (SSR) with Angular Universal
This guide describes Angular Universal, a technology that renders Angular applications on the server. A normal Angular application executes in the browser, ...
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
Hi @shih-js,
Apologies for leaving this so long, managed to grab some time this weekend. This probably isn’t of any use to you anymore tbh, but in the latest version I’ve changed the Webpack target to Node. This doesn’t allow SSR per se, but will allow dynamic importing within NextJS to load the component on the client only.
Based on the repo you posted, I did the following:
For anyone coming across this thread, I ended up using
React.lazy
in my Gatsby app to lazily load this library on the client-side only, so it wouldn’t affect SSR. Example:Then you can render the
<PWAInstallPrompt />
component anywhere in your app.Note that as of the date of the this comment, the React Suspense API is still ‘experimental’.