我需要任何帮助与融合的monaco-editor在Angular 5应用程序。所有工作在开发模式,但在生产失败。我从loader.js收到错误。我正在使用Angular Cli和ngx-monaco-editor npm-package。包存储库-https://github.com/atularen/ngx-monaco-editor
我的一些代码:
package.json:
{ "name": "lynx-backoffice", "version": "0.0.0", "license": "MIT", "scripts": { "ng": "ng", "start": "ng serve --proxy-config proxy.conf.json", "build": "ng build", "buildprod": "ng build --prod --base-href /ClientApp/dist/", "test": "ng test", "lint": "ng lint", "e2e": "ng e2e" }, "private": true, "dependencies": { "@angular/animations": "^5.0.0", "@angular/common": "^5.0.0", "@angular/compiler": "^5.0.0", "@angular/core": "^5.0.0", "@angular/forms": "^5.0.0", "@angular/http": "^5.0.0", "@angular/platform-browser": "^5.0.0", "@angular/platform-browser-dynamic": "^5.0.0", "@angular/router": "^5.0.0", "angular-tree-component": "^7.0.1", "angular2-bootstrap-switch": "^0.2.3", "bootstrap": "3.3.5", "core-js": "^2.4.1", "css-loader": "^0.28.7", "jquery": "^1.12.4", "less": "^2.7.2", "less-loader": "^4.0.5", "ng-block-ui": "^1.0.0-beta.16", "ng-selectize": "^1.1.0", "ng2-bootstrap-modal": "^1.0.1", "ng2-date-picker": "^2.7.4", "ng2-dnd": "^4.2.0", "ng2-toastr": "^4.1.2", "ngx-monaco-editor": "^5.0.0", "ngx-pagination": "^3.1.0", "ngx-simple-modal": "^1.3.8", "rxjs": "^5.5.2", "selectize": "^0.12.4", "zone.js": "^0.8.14" }, "devDependencies": { "@angular/cli": "^1.5.4", "@angular/compiler-cli": "^5.0.0", "@angular/language-service": "^5.0.0", "@types/jasmine": "~2.5.53", "@types/jasminewd2": "~2.0.2", "@types/node": "~6.0.60", "codelyzer": "~3.2.0", "jasmine-core": "~2.6.2", "jasmine-spec-reporter": "~4.1.0", "karma": "~1.7.0", "karma-chrome-launcher": "~2.1.1", "karma-cli": "~1.0.1", "karma-coverage-istanbul-reporter": "^1.2.1", "karma-jasmine": "~1.1.0", "karma-jasmine-html-reporter": "^0.2.2", "protractor": "~5.1.2", "ts-node": "~3.2.0", "tslint": "~5.3.2", "typescript": "~2.4.2" } }
{ "$schema": "./node_modules/@angular/cli/lib/config/schema.json", "project": { "name": "lynx-backoffice" }, "apps": [ { "root": "src", "outDir": "dist", "assets": [ "assets", "favicon.ico", { "glob": "**/*", "input": "../node_modules/ngx-monaco-editor/assets/monaco", "output": "./assets/monaco/" } ], "index": "index.html", "main": "main.ts", "polyfills": "polyfills.ts", "test": "test.ts", "tsconfig": "tsconfig.app.json", "testTsconfig": "tsconfig.spec.json", "prefix": "lynx", "styles": [ "../node_modules/ng2-toastr/bundles/ng2-toastr.min.css", "../node_modules/selectize/dist/css/selectize.css", "../node_modules/selectize/dist/css/selectize.bootstrap3.css", "./assets/limitless/less/css/icons/icommon/styles.css", "./assets/limitless/css/bootstrap.css", "./assets/limitless/less/_main_starters/core.less", "./assets/limitless/less/_main_starters/components.less", "./assets/limitless/less/_main_starters/colors.less", "styles.css" ], "scripts": [ "../node_modules/jquery/dist/jquery.js", "../node_modules/ng-selectize/selectize/selectize.standalone.js", "../node_modules/bootstrap/dist/js/bootstrap.js", "./assets/limitless/js/plugins/ui/nicescroll.min.js", "./assets/limitless/js/core/app.js", "./assets/limitless/js/pages/layout_fixed_custom.js" ], "environmentSource": "environments/environment.ts", "environments": { "dev": "environments/environment.ts", "prod": "environments/environment.prod.ts" } } ], "e2e": { "protractor": { "config": "./protractor.conf.js" } }, "lint": [ { "project": "src/tsconfig.app.json" }, { "project": "src/tsconfig.spec.json" }, { "project": "e2e/tsconfig.e2e.json" } ], "test": { "karma": { "config": "./karma.conf.js" } }, "defaults": { "styleExt": "css", "component": {} } }
MonacoEditorModule.forRoot()
<ngx-monaco-editor [options]="htmlEditorOptions" [(ngModel)]="model.HtmlCode"></ngx-monaco-editor>
生产错误
将baseURL
设置为与模块配置https://github.com/atularen/ngx-monaco-editor#configurations中的--base-href
相对应
const monacoConfig: NgxMonacoEditorConfig = {
// configure base path for monaco editor
baseUrl: environment.prod ? 'app-name/assets' : '',
// pass default options to be used
defaultOptions: { scrollBeyondLastLine: false },
// here monaco object will be available as window.monaco use this function to extend monaco editor functionality.
onMonacoLoad: () => { console.log((<any>window).monaco); }
};
Monaco Editor 是微软开源的基于 VS Code 的代码编辑器,运行在浏览器环境中。编辑器提供代码提示,智能建议等功能。供开发人员远程更方便的编写代码。描述代码编辑器功能的页面在这里。 安装: npm install monaco-editor 你将会得到 inside dev: bundled, not minified inside min: bundled, and minifi
Monaco Editor Component for Angular 2 and above. Angular <= 4: v3.x.x Angular 5: v5.x.x Angular 6: v6.x.x Angular 7: v7.x.x Angular 8: v8.x.x Angular 9: v9.x.x Angular 10: v10.x.x Angular 12: v12.x.x
介绍 我们会遇到需要编辑代码的场景,比如编辑json、javascript、python等等,Monaco Editor在新窗口打开 是一个好用而且强大的的代码编辑器库,引入Monaco Editor有一定的成本,插件实现了胶水代码,提供轻松引入的能力。目前内置的 Monaco Editor 版本是 1.9.1。 启用方式 在 package.json 中引入依赖: { "dependen
我正在努力调试一个NextJS API,该API正在开发中(通过本地主机),但在生产中悄无声息地失败。 下面,两个没有返回,所以我怀疑调用没有正确执行,可能会及时? 我不知道该怎么纠正,很高兴按指示调试解决这个问题!
问题内容: 我正在通过jenkins部署Ember CLI应用程序,并使用nginx发布它。这是通过詹金斯构建脚本: nginx的配置只是引导到。效果很好,但是当我转到页面时,该页面为空白,并且在控制台中显示以下输出: 我猜这两个错误是相关的,但我不知道是什么导致了它们。我曾尝试这个答案似乎是一个类似的问题,但它并没有为我工作。一切在我的开发环境中都可以正常工作,并且在里面我看不到任何可疑的东西。
我有一个生产者/消费者模式,如下所示 固定数量的生成器线程,每个线程写入它们自己的BlockingQueue,通过执行器调用 单个使用者线程,读取生产者线程 每个生产者都在运行一个数据库查询,并将结果写入其队列。消费者轮询所有生产者队列。目前,如果出现数据库错误,生产者线程就会死掉,然后消费者就会永远停留在产品队列中等待更多的结果。 我应该如何构造它来正确处理catch错误?