cuongdevjs / reactjs-social-login

Group Hook ReactJS components for login social network
https://react-social-login.netlify.app
MIT License
168 stars 75 forks source link

Doesn't work with NextJS #169

Closed RunOrVeith closed 6 months ago

RunOrVeith commented 6 months ago

Describe the bug This library does not work with nextJS, because there is already some interaction with window during import time.

To Reproduce Set up a NextJS + React App and use this library When compiling the App, you will see an error like this:

- error Error [ReferenceError]: window is not defined
    at file:///home/veith/projects/ts/node_modules/.pnpm/reactjs-social-login@2.6.3_react-dom@18.2.0_react@18.2.0/node_modules/reactjs-social-login/dist/reactjs-social-login.modern.js:1:410
    at ModuleJob.run (node:internal/modules/esm/module_job:217:25)
    at async ModuleLoader.import (node:internal/modules/esm/loader:316:24)
    at async importModuleDynamicallyWrapper (node:internal/vm/module:431:15) {
  digest: undefined
}

NextJS prerenders on the server, where the window object is not defined. Various work-arounds listed here don't work, because this already happens at import time in this library.

cuongdevjs commented 6 months ago

duplicated #7 #109 #156 #148 #144

cuongdevjs commented 6 months ago

please use {srr: false}