ngx-monaco-editor
ngx-monaco-editor copied to clipboard
Cannot find namespace 'monaco'
Hello, since upgrading to Angular 12 from 10, I am getting the following error:
error TS2503: Cannot find namespace 'monaco'.
97 editor: monaco.editor.ICodeEditor;
I did not have import statement for monaco, and if I try to add one like import * as monaco from 'monaco-editor'
, i'd get:
\server\webpack:\node_modules\monaco-editor\esm\vs\editor\editor.api.js:40if (typeof self.require !== 'undefined' && typeof self.require.config === 'function') {
Can someone please advise?
I have the same problem. I added "../node_modules/monaco-editor/monaco"
to the types
in the tsconfig.json file. So now my project compiles. However the VS code still shows red squigglies for the monaco.
Thanks @arash-sahami , I used /// <reference path="../../../../../../../../node_modules/monaco-editor/monaco.d.ts" />
at the top of the TS and it solved the issue completely. It's just I don't want to use this method at every file I use monaco