gitbrent / bootstrap-switch-button-react

Bootstrap Switch Button for React
https://gitbrent.github.io/bootstrap-switch-button-react/
MIT License
20 stars 18 forks source link

NextJS integration problem #22

Open HarisPap11 opened 4 years ago

HarisPap11 commented 4 years ago

Hello,

I'm trying to use this library in Next JS but I get the below error "Windows is not defined".

ReferenceError: window is not defined
    at r (C:\Users\papad\Desktop\harispap-xyz\node_modules\bootstrap-switch-button-react\lib\bootstrap-switch-button-react.js:1:9931)
    at s (C:\Users\papad\Desktop\harispap-xyz\node_modules\bootstrap-switch-button-react\lib\bootstrap-switch-button-react.js:1:10019)
    at t.exports (C:\Users\papad\Desktop\harispap-xyz\node_modules\bootstrap-switch-button-react\lib\bootstrap-switch-button-react.js:1:13054)
    at Object.<anonymous> (C:\Users\papad\Desktop\harispap-xyz\node_modules\bootstrap-switch-button-react\lib\bootstrap-switch-button-react.js:1:4427)
    at n (C:\Users\papad\Desktop\harispap-xyz\node_modules\bootstrap-switch-button-react\lib\bootstrap-switch-button-react.js:1:186)
    at Module.<anonymous> (C:\Users\papad\Desktop\harispap-xyz\node_modules\bootstrap-switch-button-react\lib\bootstrap-switch-button-react.js:1:1134)
    at n (C:\Users\papad\Desktop\harispap-xyz\node_modules\bootstrap-switch-button-react\lib\bootstrap-switch-button-react.js:1:186)
    at C:\Users\papad\Desktop\harispap-xyz\node_modules\bootstrap-switch-button-react\lib\bootstrap-switch-button-react.js:1:985
    at Object.<anonymous> (C:\Users\papad\Desktop\harispap-xyz\node_modules\bootstrap-switch-button-react\lib\bootstrap-switch-button-react.js:1:994)
    at Module._compile (internal/modules/cjs/loader.js:688:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
    at Module.load (internal/modules/cjs/loader.js:598:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
    at Function.Module._load (internal/modules/cjs/loader.js:529:3)
    at Module.require (internal/modules/cjs/loader.js:636:17)
    at require (internal/modules/cjs/helpers.js:20:18)
AbdulmelikKalkan commented 3 years ago

I got the same error, is there any solution?