我有一个Angular 8库lib-a,其中包含子组件child-x和child-y。
在使用lib-a时,将其引入到Angular 9项目中时,会遇到以下构建错误:
**ERROR in The target entry-point "@abc/lib-a" has missing dependencies:
- ./lib-a/child-x/child-x.component
- ./lib-a/child-y/child-y.component**
ng-package.json文件内容如下:
{
"$schema": "../../node_modules/ng-package/ng-package.schema.json",
"dest": "../../dist/lib-a",
"lib": {
"entryFile": "src/public-api.ts"
}
}
lib-a的package.json文件如下:
{
"name": "lib-a",
"version": "1.0.6",
"description": "lib a",
"peerDependencies": {
"@angular/common": "^8.0.0",
"@angular/core": "^8.0.0",
"@angular/elements": "^9.1.6",
"@angular/cdk": "^8.2.3"
}
}
Edit: public-api.ts
export * from './lib-a/lib-a.module';
export * from './lib-a/child-x/child-x.component';
export * from './lib-a/child-y/child-y.component';
我尝试通过将组件添加到public-api.ts入口点来修复问题,但这并没有起作用。
我在网上搜索,但没有找到与此子组件相关的问题的答案。