Skip to content

ReferenceError: window is not defined (SSR support) #70

Description

@Shashank-Yara

Hi,

The source you've pushed to npm invokes window even though its not required and also not in the original source code. This prevents this library from being used in server-side rendered react projects like Gatsby.js

You might want to build the source with Webpack instead of babel directly.

ERROR #95312 

"window" is not available during server side rendering.

See our docs page for more info on this error : https://gatsby.dev/debug-html

WebpackError: ReferenceError: window is not defined
  geolocator.js:14 Object../node_modules/geolocator/dist/geolocator.js
    node_modules/geolocator/dist/geolocator.js:14:2
  

It seems you guys need to update /node_modules/geolocator/dist/geolocator.js with below check for window object.

if(typeof window !== 'undefined') {
    // the entire file contents.
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions