I'm having a really annoying error when I'm running my ng-packagr
to build a NPM library to publish. Using nx monorepo,
The error:
ng-packagr -p libs/ui/ng-package.json
Building Angular Package
------------------------------------------------------------------------------
Building entry point '@ngc/ui'
------------------------------------------------------------------------------
✖ Compiling with Angular sources in Ivy partial compilation mode.
libs/ui/src/lib/ui/button/button.component.ts:14:27 - error TS2307: Cannot find module '@ngc/cdk' or its corresponding type declarations.
14 import { NgChanges } from '@ngc/cdk';
~~~~~~~~~~
Here's config of CDK lib:
{
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
"dest": "../../dist/@ngc/cdk",
"lib": {
"entryFile": "src/index.ts"
}
}
Here's the config of ui lib:
{
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
"dest": "../../dist/@ngc/ui",
"lib": {
"entryFile": "public_api.ts"
},
"allowedNonPeerDependencies": [
"@ix/ngc-button"
],
"assets": [
"@ngc/cdk"
]
}