ngstack / code-editor

Code editor component for Angular applications.
MIT License
124 stars 19 forks source link

Cannot find module 'monaco-editor' #1343

Open felix-adhinata opened 5 months ago

felix-adhinata commented 5 months ago

I am upgrading this in my project from v5.1.0 (ng16) to v7.2.0 (ng17) and then I got this error when running my test.

Error: node_modules/@ngstack/code-editor/lib/code-editor/code-editor.component.d.ts:7:24 - error TS2307: Cannot find module 'monaco-editor' or its corresponding type declarations.

7 import { editor } from 'monaco-editor';
                         ~~~~~~~~~~~~~~~

Error: node_modules/@ngstack/code-editor/lib/services/code-editor.service.d.ts:4:24 - error TS2307: Cannot find module 'monaco-editor' or its corresponding type declarations.

4 import { editor } from 'monaco-editor';

I am not installing monaco-editor on my package.json since I don't need offline mode in my project.

Will install v7.1.0 for now since it seems the imports are added on v7.2.0, but I hope this can be resolved in a future version.

natebjensen commented 4 months ago

I am having the same issue

cathey191 commented 2 months ago

Also run into this issue on an Angular 17 application. Dropping to v7.1.0 fixed this issue.

tipodisimmia commented 1 month ago

I'm not installed monaco, i run according the first part of documentation : only "npm i @ngstack/code-editor@4.0.0"

Same issue with: "@angular/compiler": "^14.2.12", "@ngstack/code-editor": "^4.0.0" Runtime log show: Error: Uncaught (in promise): ReferenceError: monaco is not defined ReferenceError: monaco is not defined at CodeEditorComponent.setupEditor (ngstack-code-editor.mjs:433:23) at ngstack-code-editor.mjs:422:14 at Generator.next () at asyncGeneratorStep (asyncToGenerator.js:3:1) at _next (asyncToGenerator.js:25:1) at asyncToGenerator.js:32:1 at new ZoneAwarePromise (zone.js:1340:33) at asyncToGenerator.js:21:1 at CodeEditorComponent.ngAfterViewInit (ngstack-code-editor.mjs:421:29) at callHook (core.mjs:2498:22) at resolvePromise (zone.js:1255:35) at zone.js:1162:21 at asyncGeneratorStep (asyncToGenerator.js:6:1) at _next (asyncToGenerator.js:25:1) at asyncToGenerator.js:32:1 at new ZoneAwarePromise (zone.js:1340:33) at asyncToGenerator.js:21:1 at CodeEditorComponent.ngAfterViewInit (ngstack-code-editor.mjs:421:29) at callHook (core.mjs:2498:22) at callHooks (core.mjs:2467:17)

And the content of editor is an empty div.....    
DenysVuika commented 1 month ago

The repository comes with example applications. Please check if it's running for you and application configuration, if you have issues.