Open jbeckton opened 7 years ago
Perhaps you could take a similar approach to what ng-bootstrap did? You can import the entire log via the NgbModule or import individual modules. Tree shaking will do the rest.
https://github.com/ng-bootstrap/ng-bootstrap/tree/master/src
@jbeckton Based on angular-library-seed
(which was already mentioned by @ShaneYu), I'm developing two kinds of things:
common-ui
kit for our organization, actually based on approach taken by ng-bootstrap
, which really works.feature-module-seed
- seed project for a isolated features with their own imbedded routing and resources. In advance they are just being imported
into a root project application. This really gives an ability to develop big features by different teams and not impacting main application directly. Even though those features are living (being rendered and functioning) as a part of a main project application. This one's also utilizing an approach of ng-bootstrap
.Basically, whole idea is based on module per component, and a '.forRoot()' convention
. Which in advance helps to successfully tree shake unused stuff via webpack or a rollup.
Don't include library scripts as a separate files. Just npm/yarn add
a whole library, use only things you need and - treeshake unneeded during prod build.
I am using your seed for a library I am building that is going to be kind of large. I am trying to set up my library source so that I can have multiple entry points like...
@mylib/security @mylib/logging @mylib/ui ...
This way consumers of the lib will be able to import modules and components from the appropriate location in the library.