Packaging Angular Libraries
- Be as non-invasive as possible: Even there’s a lot of discussions going on within the linked issues, because building a library is a non-trivial task, at some point in time, the Angular CLI will (hopefully!)
- Good thing is, there only one process running for building your app and everything what is supported by Angular CLI is supported for your package.
- Only one build process, live-reloading works across all linked libraries, it’s fast and supports everything, Angular CLI supports out-of-box.
- This is basically the same, as the generator approach and could lead to a lot of work and adjustments to keep it up-to-date with Angular CLI updates, as well as implementing everything yourself which is needed.
- Using this approach opts-out of further development of the Angular CLI, which you need to track yourself, re-eject again in an empty project and transfer all changed stuff to your own configuration.
Creating a real Angular Package Format package is a not easy to achieve task. We want to take a look at different approaches and discuss their pros and cons.
@ManuelRauber: Some thoughts on creating #Angular #Packages Includes a link to a GitHub demo repository fo…
When you want to create Angular libraries you come across a – at first sight – very simple problem: The Angular CLI currently does not support creation of Angular libraries. Only Angular applications (and all building blocks like components, services, etc.) are supported out-of-box. The feature for creating libraries is currently an open issue: see here or here – and it’s a highly discussed topic.
Naturally, the first thing you do is spinning up your favorite search engine and start searching. Likely, you come across a Google Docs describing the Angular Package Format – which may blow your mind, since it involves some work to do all the stuff you should do for creating a full-blown Angular package.
After some more searching you’ve found posts about how to create an Angular package. Most likely, the following methods are found:
And pretty sure, there are more methods than those four. Within this blog post we want to take a look at them and their – in my point of view – pros and cons.
The requirements for creating a library are pretty simple. For sure, it should support the Angular Package Format, but there are some other requirements for working with the package as well. The following list contains a list of features, which each method should have:
The last two bullet points need some more…