I have a shared component library project that is a few years old (just to say it's been working fine for a while). I want to replace some of the custom components with Angular Material components. However, when I add NgMat to the library project, I get an error when attempting to use it in a separate project.
ERROR in The target entry-point "my library project" has missing dependencies:
- @angular/material/form-field
- @angular/material/datepicker
The project package.json has:
...
"peerDependencies": {
"@angular/common": "~10.2.4",
"@angular/core": "~10.2.4",
"@angular/forms": "~10.2.4",
"@angular/material": "^10.2.4",
...
And the main package.json file has:
...
"dependencies": {
"@angular/animations": "~10.2.4",
"@angular/cdk": "^9.2.4",
"@angular/common": "~10.2.4",
"@angular/compiler": "~10.2.4",
"@angular/core": "~10.2.4",
"@angular/forms": "~10.2.4",
"@angular/material": "^10.2.4",
...
I've also whitelisted @angular/material in ng-package.json
as suggested here Dependency @ng-bootstrap/ng-bootstrap must be explicitly whiteliste while having @angular/material in the project's dependencies instead of the peerDependencies.