react-fonticonpicker
react-fonticonpicker copied to clipboard
window is undefined
i think this is about server side rendering. but i can't solve this. can you guys tell me how to fixing this issue?
thank you.
Hello,
This is definitely because of SSR. Can you put the complete trace here? If possible a repo with reproducing error? Would help me debug it.
ReferenceError: window is not defined
at Object.<anonymous> (/home/*/*/*/*/node_modules/@fonticonpicker/react-fonticonpicker/dist/webpack:/FontIconPicker/webpack/universalModuleDefinition:10:2)
at Module._compile (module.js:653:30)
at Module._extensions..js (module.js:664:10)
at Object.require.extensions.(anonymous function) [as .js] /home/*/*/*/*/node_modules/babel-register/lib/node.js:152:7)
etc ...
i hope it can help solve this issue. thank you
This can be solved with something like:
if (window) { const FontIconPicker = require("@fonticonpicker/react-fonticonpicker"); }