Hi,
I am having angular 5 application when i build an app everything is fine.fter build i am unable to view the file
node dist/server.js
node_modules/codemirror/lib/codemirror.js:18
var userAgent = navigator.userAgent;
^
ReferenceError: navigator is not defined
node_modules/codemirror/lib/codemirror.js:18:17
at userAgent (node_modules/codemirror/lib/codemirror.js:11:82)
at Object.
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:20:18)
Please help me to solve the problem.
The same issue as https://github.com/codemirror/CodeMirror/issues/5470
You need to run Codemirror in the client side.
Right, and also the same answer鈥擟odeMirror doesn't do anything useful outside of the browser, and is currently not set up to be loadable in such an environment.
@marijnh We are trying to pre-render with Server Side Rendering and then shown to the user ahead of time.
Do you have any suggestions on the best way we can overcome this problem? Perhaps we can detect navigator or just node load Code Mirror when we are rendering via SSR.
Thanks,
Most helpful comment
@marijnh We are trying to pre-render with Server Side Rendering and then shown to the user ahead of time.
Do you have any suggestions on the best way we can overcome this problem? Perhaps we can detect
navigatoror just node load Code Mirror when we are rendering via SSR.Thanks,