-
Notifications
You must be signed in to change notification settings - Fork 6
CodeMirror cannot find "navigator" #43
Comments
Having this issue, as well and manual setup isn't a workaround. Anyone know how to fix this? Reproduce:
in pages/notebook.tsx:
Error
|
You may be using SSR with react, if so you need to import addons only when loads in browser: You can try snippet like following:
|
@pnutmath I've tried a lot of dynamic imports like this and it hasn't worked so far. Ideas on where this should be put? I'd like to get a definitive solution to this if possible. The build breaks immediately - I haven't written any components that are using SSR yet, it's the default next.js boilerplate. |
@scook12 - its not a dynamic import, I am not loading this modules on server side, it imports only for client side |
Just wanted to report pnutmath's solution did work for me in Next.js
|
@markbmullins - Thanks for updating! Where did you place this code? I'm trying to get the basic instructions working on my machine to no avail. |
It goes in whatever component you were trying to import code mirror into. This replaces that import. |
I resolved this issue by changing:
to
in |
When would this issue be fixed? it's not a good solution to modify the imports in the node_modules anyway. |
For those who are seeing the same issue, the correct fix is to dynamically import the codemirror editor in the presentation-cell.js file replace the import for CodeMirrorEditor with the following
Ensure that you have also installed next/dynamic |
CodeMirror breaks the default build.
Error
Steps to reproduce
Edit: could this be related? -> JedWatson/react-codemirror#77
The text was updated successfully, but these errors were encountered: