react-fonticonpicker icon indicating copy to clipboard operation
react-fonticonpicker copied to clipboard

window is undefined

Open jeffriandriyanto opened this issue 7 years ago • 3 comments

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.

jeffriandriyanto avatar Nov 02 '18 03:11 jeffriandriyanto

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.

swashata avatar Nov 02 '18 07:11 swashata

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

jeffriandriyanto avatar Nov 02 '18 07:11 jeffriandriyanto

This can be solved with something like:

if (window) { const FontIconPicker = require("@fonticonpicker/react-fonticonpicker"); }

davidgolden avatar Jan 03 '19 18:01 davidgolden