包不适用于有角度的生产版本

时间:2019-04-01 15:10:23

标签: angular ckeditor angular-cli angular-components ckeditor5

我创建了一个将CKEditor 5包装到Angular Form Control中的库,并在npmjs上以package的形式提供了该库。

当我构建Angular应用程序时,使用ng编译该包及其模块,一切正常。

如果我构建用于生产的应用程序,则似乎缺少任何依赖项,因为我要使用的组件不起作用。

构建库后,package.json如下所示:

{
    "name": "ckeditor-form-controls",
    "version": "0.0.4",
    "peerDependencies": {
        "@angular/common": "^7.0.0",
        "@angular/core": "^7.0.0",
        "@ckeditor/ckeditor5-angular": "^1.0.1",
        "@ckeditor/ckeditor5-build-classic": "^12.0.0",
        "@angular/forms": "^7.2.11"
    },
    "main": "bundles/ckeditor-form-controls.umd.js",
    "module": "fesm5/ckeditor-form-controls.js",
    "es2015": "fesm2015/ckeditor-form-controls.js",
    "esm5": "esm5/ckeditor-form-controls.js",
    "esm2015": "esm2015/ckeditor-form-controls.js",
    "fesm5": "fesm5/ckeditor-form-controls.js",
    "fesm2015": "fesm2015/ckeditor-form-controls.js",
    "typings": "ckeditor-form-controls.d.ts",
    "metadata": "ckeditor-form-controls.metadata.json",
    "sideEffects": false,
    "dependencies": {
        "tslib": "^1.9.0"
    }
}

我得到的错误如下:

main.962748ac39bd9e0b2a2a.js:1 TypeError: Cannot read property 'childCount' of undefined
at main.962748ac39bd9e0b2a2a.js:1
at Yl (main.962748ac39bd9e0b2a2a.js:1)
at Nl (main.962748ac39bd9e0b2a2a.js:1)
at main.962748ac39bd9e0b2a2a.js:1
at br.change (main.962748ac39bd9e0b2a2a.js:1)
at Fl (main.962748ac39bd9e0b2a2a.js:1)
at zl._initPlaceholder (main.962748ac39bd9e0b2a2a.js:1)
at zl.init (main.962748ac39bd9e0b2a2a.js:1)
at main.962748ac39bd9e0b2a2a.js:1
at t.invoke (polyfills.6082c74956d5f30a31fd.js:1)
at e.run (polyfills.6082c74956d5f30a31fd.js:1)
at polyfills.6082c74956d5f30a31fd.js:1
at t.invokeTask (polyfills.6082c74956d5f30a31fd.js:1)
at e.runTask (polyfills.6082c74956d5f30a31fd.js:1)
at g (polyfills.6082c74956d5f30a31fd.js:1)
at e.invokeTask [as invoke] (polyfills.6082c74956d5f30a31fd.js:1)
at y (polyfills.6082c74956d5f30a31fd.js:1)
at XMLHttpRequest.b (polyfills.6082c74956d5f30a31fd.js:1)

我在GitHub上为此发布了一个问题:https://github.com/ckeditor/ckeditor5-build-classic/issues/68

3 个答案:

答案 0 :(得分:0)

这似乎是<!-- <dependency>--> <!-- <groupId>com.google.cloud</groupId>--> <!-- <artifactId>google-cloud-pubsub</artifactId>--> <!-- <version>1.66.0</version>--> <!-- </dependency>--> 和生产构建过程的错误。在他们的github上查看this issue here

答案 1 :(得分:0)

从您的html中删除[config]="{ placeholder: 'Description' }"。我有同样的问题。当我删除它时,它可以工作,但是没有占位符。在这种情况下,您不能使用占位符。

答案 2 :(得分:0)

我有同样的问题,以下更改对我有用:

tsconfig.json中的

  • 从“目标”:“ es2015”到“目标”:“ es6”
  • 已删除的占位符。

注意:我正在使用自己的自定义ckEditor构建:

https://www.npmjs.com/package/@gvreddy04/ckeditor5-build-classic-all-features