Angular ngxLogger и ngPackagr - проблема с упаковкой библиотеки, в которой используется ngx Logger - PullRequest
0 голосов
/ 14 марта 2019

Я использую приведенную ниже команду ng-packagr для упаковки моего приложения Angular 5, использующего ngx Logger.

> ng-packagr -p ng-package.json

И сталкиваются с ошибками ниже .....

Building Angular Package
Building entry point '@fmr-ap128496/shared-util-lib'
Compiling TypeScript sources through ngc

BUILD ERROR
src/app/modules/logging/logger.service.ts(11,23): error TS2304: Cannot find name 'Object'.
src/app/modules/logging/logger.service.ts(14,72): error TS2304: Cannot find name 'JSON'.
src/app/modules/logging/logger.service.ts(26,20): error TS2370: A rest parameter must be of an array type.
src/app/modules/logging/logger.service.ts(27,49): error TS2488: Type must have a '[Symbol.iterator]()' method that returns an iterator.

    at Object.<anonymous> (C:\Development\lib common downgrade\lib-ui\node_modules\ng-packagr\lib\ngc\compile-source-files.js:53:68)
    at Generator.next (<anonymous>)
    at C:\Development\lib common downgrade\lib-ui\node_modules\ng-packagr\lib\ngc\compile-source-files.js:7:71
    at new Promise (<anonymous>)
    at __awaiter (C:\Development\lib common downgrade\lib-ui\node_modules\ng-packagr\lib\ngc\compile-source-files.js:3:12)
    at Object.compileSourceFiles (C:\Development\lib common downgrade\lib-ui\node_modules\ng-packagr\lib\ngc\compile-source-files.js:19:12)
    at Object.<anonymous> (C:\Development\lib common downgrade\lib-ui\node_modules\ng-packagr\lib\ng-v5\entry-point\ts\compile-ngc.transform.js:28:32)
    at Generator.next (<anonymous>)
    at C:\Development\lib common downgrade\lib-ui\node_modules\ng-packagr\lib\ng-v5\entry-point\ts\compile-ngc.transform.js:7:71
    at new Promise (<anonymous>)

Вот мой package.json. Это проблема с ng-packagr или ngx-Logger? Мне кажется, что несоответствие версий.

{
  "name": "@fmr-ap128496/shared-util-lib",
  "version": "0.0.1",
  "license": "Fidelity Investments",
  "scripts": {
    ..
  },
  "private": false,
  "dependencies": {
    "@angular/animations": "^5.2.0",
    "@angular/common": "^5.2.0",
    "@angular/compiler": "^5.2.0",
    "@angular/core": "^5.2.0",
    "@angular/forms": "^5.2.0",
    "@angular/http": "^5.2.0",
    "ngx-logger": "3.1.0",
    "rxjs": "^5.5.6",
    "zone.js": "^0.8.19"
  },
  "devDependencies": {
    "@angular/cli": "~1.7.4",
    "@angular/compiler-cli": "^5.2.0",
    "@angular/language-service": "^5.2.0",
    "@types/jasmine": "~2.5.3",
    "@types/jasminewd2": "~2.0.2",
    "@types/node": "~6.0.60",
    "codelyzer": "^4.0.1",
    "ng-packagr": "4.0.0",
    "protractor": "~5.1.2",
    "ts-node": "~4.1.0",
    "tslint": "~5.9.1",
    "typescript": "~2.5.3"
  }
}
...