Shave off 11%; that’s neat! 😎 We have to try this!
I immediately grepped a fresh coffee and started to code a simple application with two lazy-loaded routes (
/shows) that allows us to list movies and tv-shows.
GitHub - kreuzerk/providerouter
This project was generated with Angular CLI version 14.2.4. Run ng serve for a dev server. Navigate to…
🤫 Pro tip! You can create lazy-loaded feature modules with the use of a simple single command!
Great! We have a nice App with two routes. Each route has a service that delivers the items and some components to display them. Nothing special.
Let’s focus on the exciting part, which for this article is the bundle size.
The whole app is
203.17 KB of it is the main bundle and
65.62 KB the router. That’s currently
26.6% of our current application.
26.6% may sound like a lot, but that's because our app is very trivial and, therefore, very small.
Okay, so that's our baseline. Let’s refactor our application to use the router's standalone APIs.