I'm publishing a library and when I cd to dist/my-library
I get the message:
ERROR: Trying to publish a package that has been compiled by Ivy. This is not allowed. Please delete and rebuild the package, without compiling with Ivy, before attempting to publish.
How do we rebuild without Ivy?
To disable Ivy:json set "aot": false; in tsconfig. app. json remove the angularCompilerOptions option or set "enableIvy": false.
The code generation step really needs to be done in the application's Angular version. So Ivy library compilation concept is a set of mechanism for running only the code generation step rapidly after library installation and mechanism for finishing the analysis step before NPM release.
"Partial" is short for "partially compiled", meaning that the compiler has only half-compiled the library code, and held off on generating the full Ivy instructions for the library.
Ivy is the code name for Angular's next-generation compilation and rendering pipeline. With the version 9 release of Angular, the new compiler and runtime instructions are used by default instead of the older compiler and runtime, known as View Engine.
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
},
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
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
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