Skip to content

Compatilibity with Next.js #26

@Bathlamos

Description

@Bathlamos

Just an FYI that your library does not seem to be compatible with SSR on Next.js. I encounter the following error when rendering a page on the server side (where the window object isn't available):

[ error ] ReferenceError: window is not defined
    at Object.<anonymous> (/Users/bathlamos/my-project/node_modules/react-scrollspy-nav/dist/ScrollspyNav.js:1:224)
    at Module._compile (internal/modules/cjs/loader.js:955:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:991:10)
    at Module.load (internal/modules/cjs/loader.js:811:32)
    at Function.Module._load (internal/modules/cjs/loader.js:723:14)
    at Module.require (internal/modules/cjs/loader.js:848:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.react-scrollspy-nav 

I would at first thought this issue to be similar to #18 except that I'm already at React 16 and the error occurs at a different place.

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