[英]ngx-monaco-editor : unable to find loader.js file from node_modules
I want to include ngx-monaco-editor in my project to create a calculator-like screen on the front-end which shows the text entered as the user clicks on the corresponding buttons.我想在我的项目中包含 ngx-monaco-editor 以在前端创建一个类似计算器的屏幕,该屏幕显示用户单击相应按钮时输入的文本。
I have installed ngx-monaco-editor (version 6.0.0) for the same.我已经安装了 ngx-monaco-editor(版本 6.0.0)。
The dependencies have been included in app.module.ts and I have added the glub to assets in the angular.json file.依赖项已包含在 app.module.ts 中,我已将 glub 添加到 angular.json 文件中的资产中。
app.component.hlml : app.component.hlml :
<ngx-monaco-editor [options]="editorOptions" [(ngModel)]="code"></ngx-monaco-editor>
app.component.ts : app.component.ts :
editorOptions = {theme: 'vs-dark', language: 'javascript'};
code: string= 'function x() {\nconsole.log("Hello world!");\n}';
The editor is not getting rendered.编辑器没有被渲染。 I'm instead getting an error that my loader.js file is not getting found.
相反,我收到一个错误,即找不到我的 loader.js 文件。
http://localhost:4200/assets/monaco/vs/loader.js net::ERR_ABORTED 404 (Not Found) @base-editor.js:65 http://localhost:4200/assets/monaco/vs/loader.js net::ERR_ABORTED 404(未找到)@base-editor.js:65
The loader.js file is located at node_modules/ngx-monaco-editor/assets/monaco/vs/loader.js and I'm able to navigate to it. loader.js 文件位于 node_modules/ngx-monaco-editor/assets/monaco/vs/loader.js ,我可以导航到它。
The error is occuring at base-editor.js, line 65. The location for this file is node_modules/ngx-monaco-editor/base-editor.js错误发生在 base-editor.js,第 65 行。此文件的位置是 node_modules/ngx-monaco-editor/base-editor.js
10.0.0 中没有资产文件夹,但在 9.0.0 版本中有我使用它并且它有效。
ngx-monaco-editor
requires monaco-editor
ngx-monaco-editor
需要monaco-editor
Install monaco-editor: npm install monaco-editor
安装 monaco-editor:
npm install monaco-editor
Add a entry under projects>architect>options>assets
in angular.json:在 angular.json 中的
projects>architect>options>assets
下添加一个条目:
{ "glob": "**/*", "input": "node_modules/monaco-editor", "output": "assets/monaco-editor" }
Changing the input configuration in angular.json enabled the files to be copied over to the dist folder.更改 angular.json 中的输入配置可以将文件复制到 dist 文件夹。 Changing the output configuration allowed the loader.json file to be found.
更改输出配置允许找到 loader.json 文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.