Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compatilibity with Next.js #26

Open
Bathlamos opened this issue Apr 13, 2020 · 1 comment
Open

Compatilibity with Next.js #26

Bathlamos opened this issue Apr 13, 2020 · 1 comment

Comments

@Bathlamos
Copy link

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.

@tolchai
Copy link

tolchai commented Jun 12, 2020

Here are possible solutions (in this case for Gatsby, but same problem) - https://www.gatsbyjs.org/docs/debugging-html-builds/#how-to-check-if-window-is-defined

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants