atularen / ngx-monaco-editor

Monaco Editor component for Angular 2 and Above
https://www.npmjs.com/package/ngx-monaco-editor
MIT License
428 stars 155 forks source link

Uncaught TypeError: Cannot read properties of undefined (reading 'VSCODE_BROWSER_CODE_LOADING' #256

Open m-russ opened 2 years ago

m-russ commented 2 years ago

Having an issue getting this working in angular 12. I'm running the boilerplate set up in the example. I am receiving this error in the console when I try to load the component Uncaught TypeError: Cannot read properties of undefined (reading 'VSCODE_BROWSER_CODE_LOADING'.

"@angular/cdk": "^12.2.9", "monaco-editor": "^0.24.0", "ngx-monaco-editor": "^12.0.0"

app.module.ts

import { MonacoEditorModule } from 'ngx-monaco-editor';

@NgModule({
  declarations: [
    ...
  ],
  imports: [
    ...
    MonacoEditorModule.forRoot()
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

editor.component.html

<ngx-monaco-editor [options]="editorOptions" [(ngModel)]="code"></ngx-monaco-editor>

editor.component.ts

...

export class EditorComponent implements OnInit, OnDestroy {
  editorOptions = {theme: 'vs-dark', language: 'javascript'};
  code: string= 'function x() {\nconsole.log("Hello world!");\n}';
  ...
}
pakollimar commented 2 years ago

could you please elaborate the issue, I didn't get you properly!

m-russ commented 2 years ago

I am receiving this error: Uncaught TypeError: Cannot read properties of undefined (reading 'VSCODE_BROWSER_CODE_LOADING' in the web console when I try to load the <ngx-monaco-editor> element after following the sample code in the README.md