I have an Angular 5 library that I expose as a package for other apps to consume from their node_modules
.
Currently, the app is Just-in-Time(JIT) compiled using rollup
and gulp
and exported as a package. So developer applications use my package in their JIT compiled form.
Researching about AOT has led me to believe that any Angular app which when AOT compiled is much more performant than its JIT counterpart on the browser. However, as a library developer, I would like to know if app developers will get any performance benefit if I were to expose my library AOT compiled?
I use ng-bootstrap
and a lot of other open-source libraries to create components in my module and add custom styling or functionalities on top of them. Do all the libraries I consume in my module also need to be in their AOT forms or I could use their JIT counterparts?
Also, I think it would be a good idea to have separate packages for my library - packageName
and packageName-aot
so that the users have an option to choose whichever library they want to use.
Apart from the entire code refactoring(changing the private variables used in the template to public, removing arrow functions, lambda expressions etc.), is there anything else I need to keep in mind before exposing my library modules in AOT form?
I cannot use the Angular CLI due to certain constraints, so will have to depend on @ngtools/webpack
to get AOT compilation if any.
Currently, my tsconfig.json
has the following options:
"angularCompilerOptions": {
"skipTemplateCodegen": true,
"strictMedtadataEmit": true,
"fullTemplateTypeCheck": true
}
I have searched a lot on the internet, but the Angular AOT docs are pretty vague and are not very clear for what I have been trying to do here. Any sort of direction would be really helpful.
Thanks!