How to compile a library without Ivy?

Within the library project there is a tsconfig.lib.json file. Here's my Angular compiler configuration:

  "angularCompilerOptions": {
    "skipTemplateCodegen": true,
    "strictMetadataEmit": true,
    "enableResourceInlining": true,
    "enableIvy": false
  },


To Fix this warning:

Try to disable Ivy in tsconfig.lib.json by adding below line to "angularCompilerOptions" :-

"enableIvy": false

Or

build with --prod

example: ng build your-package-name --prod


Fix for angular 9.x.x

If you migrated your app to angular 9 and you see this kind of error, make sure to build your library with --prod option it will not build with IVY

ng build yourLibraryName --prod

When you will pass --prod it will build without the ivy option and it will be allowed to be published.

As part of the migration, angular CLI create tsconfig.lib.prod.json and configure to not use IVY and you are all set