I have installed the html2canvas in my angular library project and, when I compile in production mode (running the ng build --prod
command), I'm receiving the following error:
ERROR: Dependency @types/html2canvas must be explicitly allowed using the "allowedNonPeerDependencies" option.
How can I solve it?
You can add the library to your peerDependencies in package.json
. I strongly recommend using the peerDependencies strategy since exposes explicitly to others that your library depended on other libraries:
{
...
"scripts": {...},
"peerDependencies": {
...
"@types/html2canvas": "0.0.36",
...
},
}
Or you can use the option on your ng-package.json:
{
...
"lib": {
"entryFile": "src/public-api.ts"
},
"allowedNonPeerDependencies": [
"@type/html2canvas"
]
...
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With