docs: add note on publishing libraries in ivy (#36556)
Libraries are still build using view engine even after Ivy being the default engine for building angular apps. Added note on why libraries are built using VE and how they will be automatically compiled in Ivy using ngcc making it compatible for both Fixes #35625 PR Close #36556
This commit is contained in:
parent
713fb3b587
commit
87fdd23157
|
@ -109,7 +109,9 @@ To learn more, see [Schematics Overview](guide/schematics) and [Schematics for
|
||||||
|
|
||||||
## Publishing your library
|
## Publishing your library
|
||||||
|
|
||||||
Use the Angular CLI and the npm package manager to build and publish your library as an npm package. It is not recommended to publish Ivy libraries to NPM repositories. Before publishing a library to NPM, build it using the `--prod` flag which will use the older compiler and runtime known as View Engine instead of Ivy.
|
Use the Angular CLI and the npm package manager to build and publish your library as an npm package.
|
||||||
|
|
||||||
|
Before publishing a library to NPM, build it using the `--prod` flag which will use the older compiler and runtime known as View Engine instead of Ivy.
|
||||||
|
|
||||||
<code-example language="bash">
|
<code-example language="bash">
|
||||||
ng build my-lib --prod
|
ng build my-lib --prod
|
||||||
|
@ -119,6 +121,14 @@ npm publish
|
||||||
|
|
||||||
If you've never published a package in npm before, you must create a user account. Read more in [Publishing npm Packages](https://docs.npmjs.com/getting-started/publishing-npm-packages).
|
If you've never published a package in npm before, you must create a user account. Read more in [Publishing npm Packages](https://docs.npmjs.com/getting-started/publishing-npm-packages).
|
||||||
|
|
||||||
|
<div class="alert is-important">
|
||||||
|
|
||||||
|
For now, it is not recommended to publish Ivy libraries to NPM because Ivy generated code is not backward compatible with View Engine, so apps using View Engine will not be able to consume them. Furthermore, the internal Ivy instructions are not yet stable, which can potentially break consumers using a different Angular version from the one used to build the library.
|
||||||
|
|
||||||
|
When a published library is used in an Ivy app, the Angular CLI will automatically convert it to Ivy using a tool known as the Angular compatibility compiler (`ngcc`). Thus, by publishing your libraries using the View Engine compiler ensures that they can be transparently consumed by both View Engine and Ivy apps.
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
{@a lib-assets}
|
{@a lib-assets}
|
||||||
|
|
||||||
## Managing assets in a library
|
## Managing assets in a library
|
||||||
|
|
Loading…
Reference in New Issue