Search code examples
angularangular-cliangular-libraryangular-cli-v9

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


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

  • UPDATE ANGULAR 12

    using the --configuration production option while building the library fixed my issue

    ng build --configuration production
    

    Original answer:

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

    ng build yourLibraryName --prod