react-leaflet-google-layer icon indicating copy to clipboard operation
react-leaflet-google-layer copied to clipboard

Cannot get running with server side rendering

Open owlyowl opened this issue 6 years ago • 2 comments

There's something in the setup or use with leaflet which means I can't get this running with server side rendering. apparently window isn't defined

owlyowl avatar Aug 29 '19 00:08 owlyowl

Hi,

Looks like it's a leaflet and react-leaflet issue: https://github.com/PaulLeCam/react-leaflet/issues/45

Another issue is that GoogleMutant (a library which this library depends on) is working with the window object as well:

https://gitlab.com/IvanSanchez/Leaflet.GridLayer.GoogleMutant/blob/master/Leaflet.GoogleMutant.js#L27

aviklai avatar Aug 29 '19 04:08 aviklai

I tried using react-leaflet-universal but unfortunately that doesn't work either.

I also tried to do the old set a state value in an useEffect and only render map and tiles etc but that doesn't seem to work either as the window object appears in the compiled dependency code.

owlyowl avatar Aug 29 '19 04:08 owlyowl