1

我已经使用ng-packagr为我的控件创建角度包。它像美丽一样被创造出来。但是如果我在 angular-universal 示例中使用该包,它会在捆绑时引发以下错误

ERROR in ./node_modules/@syncfusion/ej2-angular-grids/@syncfusion/ej2- 
angular-grids.es5.js
Module parse failed: Identifier '__extends' has already been declared 
(1836:9)
You may need an appropriate loader to handle this file type.
|     }
| }
| import { __extends } from "tslib";
| var __decorate$1 = (this && this.__decorate) || function (decorators,  
target, key, desc) {
|     var c = arguments.length, r = c < 3 ? target : desc === null ? desc = 
Object.getOwnPropertyDescriptor(target, key) : desc, d;

如果我创建正常的 angular-cli,也会出现同样的问题,但我已经通过升级 compiler-cli 包解决了,但普遍无法解决这个问题。

ng-packagr 配置

ng-package.json

{
 "$schema": "./node_modules/ng-packagr/ng-package.schema.json",
  "lib": {
    "entryFile": "./public_api.ts"
  },
  "whitelistedNonPeerDependencies": [
    "syncfusion",
    "typedoc", "angular"
  ]
}

包.json

"scripts": {
        "packagr": "ng-packagr -p ng-package.json"
    }

它抛出 ts-lib 错误,我想解决这个问题,或者我想知道如何在 ng-packagr 中禁用ts-lib

4

0 回答 0