Improving the size of your app – lazy loading
A good strategy for separating modules from your Angular application will increase your team’s productivity and improve code organization. But another advantage that will impact the quality for your user is the use of the lazy loading technique for modules.
If we run the build process of the sample application using the ng build
command, we can see the following message:
Figure 2.4 – Sample application bundle size
The size of our application’s initial bundle (the main.ts
file) is 94.73 kB, which may seem small, but for the size of our application with few features, it is a considerable size.
As the project has more features, the tendency is for this initial bundle to increase considerably, harming our users’ experience as they will initially need to download a larger file. This problem particularly manifests itself in environments where the internet is not very good...