uiwjs / react-codemirror

CodeMirror 6 component for React. @codemirror https://uiwjs.github.io/react-codemirror/
https://uiwjs.github.io/react-codemirror/
MIT License
1.52k stars 126 forks source link

Getting "document is not defined" error on while our app loads CodeMirrorEditor #671

Open Deepali1211 opened 4 days ago

Deepali1211 commented 4 days ago

Problem:

Our app is crashing while loading the Code Mirror Editor since version 4.22.2 with the error document is not defined It was working fine till version 4.22.1

Here is the stacktrace:

Error rendering react template: Failed to render app on server with exception document is not defined ReferenceError: document is not defined
    at /app/node_modules/codemirror/lib/codemirror.js:88:3
    at /app/node_modules/codemirror/lib/codemirror.js:11:83
    at Object.<anonymous> (/app/node_modules/codemirror/lib/codemirror.js:14:2)
    at Module._compile (node:internal/modules/cjs/loader:1467:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1551:10)
    at Module.load (node:internal/modules/cjs/loader:1282:32)
    at Function.Module._load (node:internal/modules/cjs/loader:1098:12)
    at TracingChannel.traceSync (node:diagnostics_channel:315:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:215:24)
    at Module.require (node:internal/modules/cjs/loader:1304:12)
    at require (node:internal/modules/helpers:123:16)
    at Object.<anonymous> (/app/node_modules/react-codemirror17/index.js:70:8)
    at Module._compile (node:internal/modules/cjs/loader:1467:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1551:10)
    at Module.load (node:internal/modules/cjs/loader:1282:32)
    at Function.Module._load (node:internal/modules/cjs/loader:1098:12)
    at TracingChannel.traceSync (node:diagnostics_channel:315:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:215:24)
    at Module.require (node:internal/modules/cjs/loader:1304:12)
    at require (node:internal/modules/helpers:123:16)
    at Object.<anonymous> (/app/node_modules/@console/pal/Components/lib/CodeSidePanel/CodeSidePanel.js:8:24)
    at Module._compile (node:internal/modules/cjs/loader:1467:14)
jaywcjlove commented 4 days ago

@Deepali1211 Can you provide an example that reproduces the error? I'll help you troubleshoot it.

Deepali1211 commented 4 days ago

Thank you. I don't think so I can share an example to reproduce this error. Let me know if any other information can help.

jaywcjlove commented 4 days ago

https://github.com/uiwjs/react-codemirror/compare/v4.22.1...v4.22.2

@Deepali1211 I haven't made any significant changes, and I can't reproduce your error.