1

我非常需要为我组织的 Ionic 资产构建一个单一仓库。我们制作了一套应用程序,并希望尽可能多地共享以缩短我们的上市时间。我ng-packagr一周前发现的,认为它比我以前使用的方法要好得多。

无论如何,我正在开发一个概念验证,并且无法ionic-angular编译库。ngc休息,我不知道如何去修复它。

首先,让我分享一下package.json,看看我是否走在正确的轨道上:

{
  "name": "ionic-packagr-test",
  "version": "0.0.1",
  "author": "Ionic Framework",
  "homepage": "http://ionicframework.com/",
  "private": false,
  "scripts": {
    "clean": "ionic-app-scripts clean",
    "build": "ionic-app-scripts build",
    "lint": "ionic-app-scripts lint",
    "ionic:build": "ionic-app-scripts build",
    "ionic:serve": "ionic-app-scripts serve",
    "packagr": "ng-packagr -p ng-package.json"
  },
  "dependencies": {
    "@angular/animations": "5.2.11",
    "@angular/common": "5.2.11",
    "@angular/compiler": "5.2.11",
    "@angular/core": "5.2.11",
    "@angular/forms": "5.2.11",
    "@angular/http": "5.2.11",
    "@angular/platform-browser": "5.2.11",
    "@angular/platform-browser-dynamic": "5.2.11",
    "@ionic-native/core": "4.9.1",
    "@ionic-native/splash-screen": "4.9.1",
    "@ionic-native/status-bar": "4.9.1",
    "@ionic/storage": "^2.1.3",
    "ionic-angular": "3.9.2",
    "ionicons": "3.0.0",
    "rxjs": "^5.5.2",
    "sw-toolbox": "3.6.0",
    "zone.js": "0.8.26"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "^0.6.8",
    "@angular/cli": "^6.0.8",
    "@angular/compiler-cli": "^5.2.11",
    "@angular/language-service": "^6.0.7",
    "@ionic/app-scripts": "3.1.10",
    "@types/node": "^10.5.2",
    "ng-packagr": "^3.0.3",
    "ts-node": "^7.0.0",
    "tslint": "^5.10.0",
    "typescript": "~2.6.2"
  },
  "description": "An Ionic project"
}

我正在尝试构建一个漂亮的香草组件,只需使用 shell Ionic 空白模板并app.module.ts在我的public_api.ts文件中导出。

运行打包程序时,出现以下错误:

BUILD ERROR
node_modules/ionic-angular/components/picker/picker-component.d.ts.PickerCmp.html(13,71): : Expected 0 arguments, but got 1.
node_modules/ionic-angular/components/input/input.d.ts.TextInput.html(1,928): : Expected 0 arguments, but got 1.
node_modules/ionic-angular/components/input/input.d.ts.TextInput.html(1,961): : Expected 0 arguments, but got 1.

Error: node_modules/ionic-angular/components/picker/picker-component.d.ts.PickerCmp.html(13,71): : Expected 0 arguments, but got 1.
node_modules/ionic-angular/components/input/input.d.ts.TextInput.html(1,928): : Expected 0 arguments, but got 1.
node_modules/ionic-angular/components/input/input.d.ts.TextInput.html(1,961): : Expected 0 arguments, but got 1.

有没有可能我使用了错误的版本ng-packagr

提前致谢。

4

1 回答 1

1

经过几天的寻找找到了一个教程。不会复制/粘贴文章——不想抄袭或抑制来自他网站的流量。

本质上,都dependencies应该成为devDependencies. 如果您的包使用任何devDependencies 复制它们作为peerDependencies.

于 2018-07-19T18:50:36.997 回答