How would you optimize the angular 2 application for better performance?
Well, optimization depends on the type and size of application and many other factors. But in general, I would consider the following points while optimizing the angular 2 app:
- Consider AOT compilation.
- Make sure the application is bundled, uglified, and tree shaking is done.
- Make sure the application doesn’t have un-necessary import statements.
- Make sure that any 3 rd party library, which is not used, is removed from the application.
- Have all dependencies and dev-dependencies are clearly separated.
- I would consider lazy loading instead of fully bundled app if the app size is more.