Static vs Dynamic bootstrapping of Angular2 app

1.1k Views Asked by At

In angular2 RC5, we launch the application by bootstrapping the main module of the app and angular provides two options for bootstrapping when targeting the browser. There is the option for dynamic bootstrapping or static.

Docs mention that Static, produces smaller application, so there is a performance boost but it is not clear to me when it is best to use each method and which method is preferred for production, and what are the benefits when dynamic compilation is used. Can someone explain?

1

There are 1 best solutions below

1
On

Take a look at this link:

https://angular.io/docs/ts/latest/cookbook/aot-compiler.html

My understanding is that Dynamic bootstrapping resulting in JIT (Just In Time) compilation is best suited for development. You can quickly make changes and let the the application recompile during run-time in your browser without having to rebuild the application.

Static bootstrapping which requires AOT (Ahead of Time) compilation (i.e. building the application off line) is best suited for production environments and has the added benefits of better performance (rendering and total download size), less async calls, better security and early template error detection.