react-run-code icon indicating copy to clipboard operation
react-run-code copied to clipboard

Dynamic import required with SSR, not necessary

Open MatthewCaseres opened this issue 5 years ago • 0 comments

When monacoEditor.tsx imports ConsoleLog it causes error "document not defined". In the version of this package that is not on npm (the npm component grew out of a component from a NextJS project) this is solved with using a dynamic import via "next/dynamic".

I tried some hacks to make this work a while ago, not sure what the solution is. I had some wacky if(window){const ConsoleLog = require("./ConsoleLog")} or something like that, but TSDX didn't like it and maybe it just wasn't a good way of doing things.

MatthewCaseres avatar Nov 12 '20 11:11 MatthewCaseres