[Fixed] angular 9 library publish error "Trying to publish a package that has been compiled by Ivy"

Issue

I migrated my angular 8.x.x project to angular 9.x.x and when I try to publish my library, it fails with below error

npm ERR! @candiman/[email protected] prepublishOnly: node --eval "console.error('ERROR: Trying to publish a package that has been compiled by Ivy. This is not allowed.\nPlease delete and rebuild the package, without compiling with Ivy, before attempting to publish.\n')" && exit 1

is there anything changed in the angular 9

Solution

using --prod option while building the library fixed my issue

ng build yourLibraryName --prod

Leave a Reply

(*) Required, Your email will not be published