requestidlecallback-polyfill icon indicating copy to clipboard operation
requestidlecallback-polyfill copied to clipboard

Prevent code from running on server side (add support for Next.js SSR)

Open arielitovsky opened this issue 3 years ago • 2 comments

When using this library with Next.js and their Server Side Generation, I ran into an issue where the rendering server will return an error:

ReferenceError: window is not defined

This PR fixes that issue and allows us to skip this code on the server, but continue running on the client side.

arielitovsky avatar Aug 16 '21 18:08 arielitovsky

we need this

hanayashiki avatar Aug 26 '22 00:08 hanayashiki

+1, need this!

albertpurnama avatar Feb 28 '23 02:02 albertpurnama