Skip to content

Add support for server side rendering #2

@MatiMenich

Description

@MatiMenich

Hi! I'm trying to use this library for a Gatsby project, but when I try to build it for production, it fails because the window object is undefined.

2020-09-10T13:24:12.621Z [WARNING]: error "window" is not available during server side rendering.
2020-09-10T13:24:12.641Z [INFO]: 11 |     isLandscape,
                                 12 |     isPortrait: !isLandscape,
                                 > 13 |     isHDPI: window.devicePixelRatio > 1,
                                 | ^
                                 14 |     innerWidth: iw,
                                 15 |     innerHeight: ih,
                                 16 |     media: {}
...

Adding support for SSR would be great, thanks!

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions