WHow to Reduce the Production Bundle Size of Your App? — Angular

Building a wonderful application is super cool, but not getting the most of the Angular robust framework is a shame. In this article, I’m going to talk about the bundle size. What a headache for large enterprise applications, Nah?

One of the differences between React apps and Angular, the bundle size that is usually bigger for Angular apps. Angular is a robust framework that comes with many interesting and useful libraries to reduce your Angular app’s bundle size.

This article gives you the essentials you’ll need to reduce your app’s bundle size and get the most of the Angular framework.

To do this, here is the plan I’m going to follow bellow:

  • Lazy loading and preloading strategy
  • Impacts of tuning imports
  • Updating is essential
  • Takeouts

Excited, Nah? let’s dive in 😆

Lazy Loading & preloading strategy

Enterprise large applications have a lot of features and functionalities that are not accessible right away after launching the app or not often used for a lot of reasons such as the user has not the right to access if he isn’t logged in, or because he’s not interested in some of the app features …etc.

When you build the app, it’s a shame to have all the functionalities in one package, knowing that they do not necessarily need to be loaded neither used right away after launching the app. What would be great here is splitting the bundle and having only the essential, the must-have when launching the app in the main bundle and load in demand for the rest of the chunks or bundles.

Lazy loading is a key strategy that helps you chunk up your production bundle into several pieces. Instead of having one big production bundle, you would have many smaller “chunks.”

https://www.reddit.com/r/SteelersvJaguars/
https://www.reddit.com/r/LiverpoolvLeicester/
https://www.reddit.com/r/PatriotsvTexans/
https://www.reddit.com/r/SteelersJaguarslivest/
https://www.reddit.com/r/SteelersvJaguars/
https://www.reddit.com/r/LiverpoolvLeicester/
https://www.reddit.com/r/PatriotsvTexans/
https://www.reddit.com/r/SteelersJaguarslivest/
https://pianotiles.tumblr.com/post/635499772944465920/ebate-to-crash-75-india-american-newj
https://www.1upfun.com/link/672343/steelers-vs-jaguars-live-stream-reddit
https://www.links4seo.com/link/830997/steelers-vs-jaguars-live-stream-reddit
http://www.4mark.net/story/2831771/%3Esteelers-vs-jaguars-live-stream-reddit-%e2%80%a2-r-steelersvjaguars
https://pastelink.net/29y81
https://slexy.org/view/s2McuoimmG
https://jsfiddle.net/aktpor27/
https://pasteio.com/xhzujDdS9zKY
https://paiza.io/projects/EnL0C1XL2sj-4keeVHBvYQ?language=php
http://forum.ppr.pl/viewtopic.php?t=788846&start=0&postdays=0&postorder=desc&highlight=
https://forums.ubisoft.com/showthread.php/2295986-Biden-debate-to-crash-75-India-American-NEWJ-Forums
https://www.peeranswer.com/question/5fba82249e41a7d666de6be7
https://mojalos.hatenablog.com/entry/2020/11/23/003410

This is extremely powerful because:

  • First: Your app loading time will diminish considerably based on your app size.
  • Second: Your app will be a smart one. It won’t load everything stupidly and ends up using only 30% of its bundle. A shame, Nah?

To know more about this powerful strategy, I invite you to read this article for more details and advanced strategies you’d be surprised to learn about:

Enjoy 😉

Impacts of tuning imports

In large applications, with big teams or even multiple teams. We have dead code for some reasons we forgot to delete, or some imports not used. After all, we are humans. We make mistakes. Thankfully, the ECMAScript6 module system comes to rescue us with the ability to tree-shake. With this powerful system, we can remove the dead code non-being used.

To do this in your app, you need first to follow these steps:

Step #1: Analyze your current bundle size

  • You can analyze your current bundle size with: webpack-bundle-analyzer. Based on its results, you can visually see which packages are the biggest.
  • Analyze and find which package to tune-up.

Step #2: Start toning up

  • Example: by changing your imports that targets the whole library lodash into the default import equivalent: import last from ‘lodash'. This change will make a big difference since all we need is last function and not the entire library. This would turn kilobytes into bytes in terms of your production bundle size.
  • Another option is changing the entire library to a lighter alternative if it exists. If we take loadch example we can use instead lodash-es.

Step #3: Keep analyzing and tuning

Tuning your imports can shave a lot of JavaScript off of your production bundle because it ensures that you are only importing the JavaScript that you need into your app.

Updating Angular is essential

Update! the more you are far away from the last Angular version, the more painful it will be to migrate to the last version. I have experimented with migrating an app from Angular 4 to Angular 9. It was dangerous for my nerves.

Beginning with version 9, Angular starts using the new Ivy compiler. The Ivy compiler introduces several optimizations into the rendering and compilation phase of your app. And yeah! These optimizations will fasten your app and help in making your production bundle size smaller.

That’s not all. The more you are far away from the last Angular version, the more painful it will be to migrate to the last version. I have experimented with migrating an app from Angular 4 to Angular 9. It was dangerous for my nerves.

So upgrading Angular is so important.

If you are interested in more tips for clean and well coded Angular apps, here is the article for you:

https://www.reddit.com/r/nfl_wk11streams/comments/jyw9jf/officialeagles_vs_browns_live_streamsreddit/
https://www.reddit.com/r/nfl_wk11streams/comments/jyw9mi/officiallivestream_eagles_vs_browns_live/
https://www.reddit.com/r/nfl_wk11streams/comments/jyw9n0/officiallivestream_2020eagles_vs_browns_live/
https://www.reddit.com/r/nfl_wk11streams/comments/jyw9ne/livestreamofficialeagles_vs_browns_live_streams/
https://www.reddit.com/r/nfl_wk11streams/comments/jyw9nv/eagles_vs_browns_2020_live_stream_reddit/
https://www.reddit.com/r/nfl_wk11streams/comments/jyw9ol/officialfalcons_vs_saints_live_streamsreddit/
https://www.reddit.com/r/nfl_wk11streams/comments/jyw9p5/officiallivestream_falcons_vs_saints_live/
https://www.reddit.com/r/nfl_wk11streams/comments/jyw9pi/officiallivestream_2020falcons_vs_saints_live/
https://www.reddit.com/r/nfl_wk11streams/comments/jyw9q0/falcons_vs_saints_2020_live_stream_reddit/
https://www.reddit.com/r/nfl_wk11streams/comments/jyw9qb/livestreamofficialfalcons_vs_saints_live_streams/
https://www.reddit.com/r/nfl_wk11streams/comments/jyw9qo/officialbengals_vs_redskins_live_streamsreddit/
https://www.reddit.com/r/nfl_wk11streams/comments/jyw9ra/officiallivestream_bengals_vs_redskins_live/
https://www.reddit.com/r/nfl_wk11streams/comments/jyw9rn/officiallivestream_2020bengals_vs_redskins_live/
https://www.reddit.com/r/nfl_wk11streams/comments/jyw9sb/bengals_vs_redskins_2020_live_stream_reddit/
https://www.reddit.com/r/nfl_wk11streams/comments/jyw9sm/livestreamofficialbengals_vs_redskins_live/
https://www.reddit.com/r/nfl_wk11streams/comments/jyw9sv/officiallions_vs_panthers_live_streamsreddit/
https://www.reddit.com/r/nfl_wk11streams/comments/jyw9te/officiallivestream_lions_vs_panthers_live/
https://www.reddit.com/r/nfl_wk11streams/comments/jyw9up/officiallivestream_2020lions_vs_panthers_live/
https://www.reddit.com/r/nfl_wk11streams/comments/jyw9v7/lions_vs_panthers_2020_live_stream_reddit/
https://www.reddit.com/r/nfl_wk11streams/comments/jyw9vo/livestreamofficiallions_vs_panthers_live_streams/
https://www.reddit.com/r/nfl_wk11streams/comments/jyw9wx/officialsteelers_vs_jaguars_live_streamsreddit/
https://www.reddit.com/r/nfl_wk11streams/comments/jyw9xe/officiallivestream_steelers_vs_jaguars_live/
https://www.reddit.com/r/nfl_wk11streams/comments/jyw9y5/officiallivestream_2020steelers_vs_jaguars_live/
https://www.reddit.com/r/nfl_wk11streams/comments/jyw9yj/steelers_vs_jaguars_2020_live_stream_reddit/
https://www.reddit.com/r/nfl_wk11streams/comments/jyw9z7/livestreamofficialsteelers_vs_jaguars_live/
https://www.reddit.com/r/nfl_wk11streams/comments/jyw9zp/officialtitans_vs_ravens_live_streamsreddit/
https://www.reddit.com/r/nfl_wk11streams/comments/jywa04/officiallivestream_titans_vs_ravens_live/
https://www.reddit.com/r/nfl_wk11streams/comments/jywa1v/officiallivestream_2020titans_vs_ravens_live/
https://www.reddit.com/r/nfl_wk11streams/comments/jywa0u/titans_vs_ravens_2020_live_stream_reddit/
https://www.reddit.com/r/nfl_wk11streams/comments/jywa2w/livestreamofficialtitans_vs_ravens_live_streams/
https://www.reddit.com/r/nfl_wk11streams/comments/jywa37/officialpatriots_vs_texans_live_streamsreddit/
https://www.reddit.com/r/nfl_wk11streams/comments/jywa3n/officiallivestream_patriots_vs_texans_live/
https://www.reddit.com/r/nfl_wk11streams/comments/jywa48/officiallivestream_2020patriots_vs_texans_live/
https://www.reddit.com/r/nfl_wk11streams/comments/jywa4u/patriots_vs_texans_2020_live_stream_reddit/
https://www.reddit.com/r/nfl_wk11streams/comments/jywa5a/livestreamofficialpatriots_vs_texans_live_streams/
https://www.reddit.com/r/nfl_wk11streams/comments/jywa5p/officialleeds_united_vs_arsenal_live_streamsreddit/
https://www.reddit.com/r/nfl_wk11streams/comments/jywa5w/officiallivestream_leeds_united_vs_arsenal_live/
https://www.reddit.com/r/nfl_wk11streams/comments/jywa6d/officiallivestream_2020leeds_united_vs_arsenal/
https://www.reddit.com/r/nfl_wk11streams/comments/jywa6q/leeds_united_vs_arsenal_2020_live_stream_reddit/
https://www.reddit.com/r/nfl_wk11streams/comments/jywa72/livestreamofficialleeds_united_vs_arsenal_live/
http://www.onfeetnation.com/profiles/blogs/sdsdfsdfhsfh
http://network-marketing.ning.com/profiles/blogs/sagsdfhsjhdfg
https://paste2.org/LJPn1HFU
https://pastelink.net/29xs3
https://pasteio.com/xk9nb4YqrvXX

💼

  • Analyzing your bundle size with webpack-bundle-analyzer.
  • Take advantage of the ES6 module system to tune up your app and remove dead code by the tree-shaking ability.
  • Lazy loading can chunk your big bundle up into bite-sized pieces.
  • The Lazy loading strategy will boost your app performance with faster loading time.
  • Updating is essential to get the most of the bundle optimizations that the framework provides.
  • Here is your ultimate guide to upgrading: LINK.

Dear readers and friends, thank you for your support and your precious time. I hope this was useful and helpful for you.

See you soon (ノ◕ヮ◕)ノ*:・゚✧

FAM

WRITTEN BY

https://www.reddit.com/r/topsprotslive/comments/jywcid/officiallivestream_seattle_seahawks_vs_new/
https://www.reddit.com/r/topsprotslive/comments/jywcik/redditstreams_eagles_vs_browns_live_streamsreddit/
https://www.reddit.com/r/topsprotslive/comments/jywciu/nflstreamsthread_eagles_vs_browns_2020_live/
https://www.reddit.com/r/topsprotslive/comments/jywciz/officialnflstreams_eagles_vs_browns_night_fight/
https://www.reddit.com/r/topsprotslive/comments/jywcj9/officiallivestream_2020falcons_vs_saints_live/
https://www.reddit.com/r/topsprotslive/comments/jywcjf/live_thread_falcons_vs_saintslive_streamsreddit/
https://www.reddit.com/r/topsprotslive/comments/jywcjp/officiallivestreamfalcons_vs_saints_live/
https://www.reddit.com/r/topsprotslive/comments/jywcju/officiallivestreamfalcons_vs_saints_live/
https://www.reddit.com/r/topsprotslive/comments/jywck5/officialstreamsfalcons_vs_saints_2020_live_free/
https://www.reddit.com/r/topsprotslive/comments/jywckh/streamsredditlions_vs_panthers_live_streamsreddit/
https://www.reddit.com/r/topsprotslive/comments/jywcks/streamsreddit_lions_vs_panthers_live_streamsreddit/
https://www.reddit.com/r/topsprotslive/comments/jywcl2/officialnflrstreamslions_vs_panthers_week11live/
https://www.reddit.com/r/topsprotslive/comments/jywcl9/officiallivestream_lions_vs_panthers_live/
https://www.reddit.com/r/topsprotslive/comments/jywcll/officialstream2020_lions_vs_panthers_live_reddit/
https://www.reddit.com/r/topsprotslive/comments/jywclv/2020_steelers_vs_jaguars_ive_streamreddit/
https://www.reddit.com/r/topsprotslive/comments/jywcm4/officiallivestream_steelers_vs_jaguars_live/
https://www.reddit.com/r/topsprotslive/comments/jywcmp/streamofficial2020steelers_vs_jaguars_live/
https://www.reddit.com/r/topsprotslive/comments/jywcmv/livestreamssteelers_vs_jaguars_liveredditreddit/
https://www.reddit.com/r/topsprotslive/comments/jywcn4/streamofficial2020steelers_vs_jaguars_live/
https://www.reddit.com/r/topsprotslive/comments/jywcng/officialreddittitans_vs_ravens_live_streamsreddit/
https://www.reddit.com/r/topsprotslive/comments/jywcnr/officialtitans_vs_ravenslive_streamsreddit2020/
https://www.reddit.com/r/topsprotslive/comments/jywco2/officialstreams_titans_vs_ravenslive/
https://www.reddit.com/r/topsprotslive/comments/jywcoi/titans_vs_ravens_live_free_by_streamsreddit_2020/
https://www.reddit.com/r/topsprotslive/comments/jywcot/officialreddittitans_vs_ravens_live_streamsreddit/
https://www.reddit.com/r/topsprotslive/comments/jywcp2/officialredditpatriots_vs_texans_live/
https://www.reddit.com/r/topsprotslive/comments/jywcp9/officialstreams_patriots_vs_texanslive/
https://www.reddit.com/r/topsprotslive/comments/jywcpm/officialpatriots_vs_texanslive_streamsreddit/
https://www.reddit.com/r/topsprotslive/comments/jywcpw/officialredditpatriots_vs_texans_live/
https://www.reddit.com/r/topsprotslive/comments/jywcqh/officialpatriots_vs_texans_live_streamsreddit/
https://www.reddit.com/r/topsprotslive/comments/jywcqr/officiallivetvleeds_united_vs_arsenal_live/
https://www.reddit.com/r/topsprotslive/comments/jywcr0/officialthread_leeds_united_vs_arsenal_live/
https://www.reddit.com/r/topsprotslive/comments/jywcrg/offitialsleeds_united_vs_arsenal_live/
https://www.reddit.com/r/topsprotslive/comments/jywcrp/offitialsstreams_leeds_united_vs_arsenal_live/
https://www.reddit.com/r/topsprotslive/comments/jywcru/officialsstreamsleeds_united_vs_arsenal_live/
https://www.reddit.com/r/topsprotslive/comments/jywcs6/offitialsstreamsarsenal_vs_leeds_united_live/
https://www.reddit.com/r/topsprotslive/comments/jywcsf/officialfreearsenal_vs_leeds_unitedlive/
https://www.reddit.com/r/topsprotslive/comments/jywcsm/officialstreamsarsenal_vs_leeds_unitedlive/
https://www.reddit.com/r/topsprotslive/comments/jywcsy/streamsarsenal_vs_leeds_united_livestreamreddit/
https://www.reddit.com/r/topsprotslive/comments/jywct3/offitialsstreamsarsenal_vs_leeds_united_live/
https://www.reddit.com/r/topsprotslive/comments/jywctf/offitialsliverpool_vs_leicester_city_live/
https://www.reddit.com/r/topsprotslive/comments/jywcts/officiallivestreamliverpool_vs_leicester_city/
https://www.reddit.com/r/topsprotslive/comments/jywctx/officialstreamsliverpool_vs_leicester_citylive/
https://www.reddit.com/r/topsprotslive/comments/jywcu7/officiallivestrem_liverpool_vs_leicester_city/
https://www.reddit.com/r/topsprotslive/comments/jywcuk/offitialsliverpool_vs_leicester_city_live/
https://www.reddit.com/r/topsprotslive/comments/jywcur/officialstreams_leicester_city_vs_liverpoollive/
https://www.reddit.com/r/topsprotslive/comments/jywcux/offitialsleicester_city_vs_liverpool_live/
https://www.reddit.com/r/topsprotslive/comments/jywcv7/offitialsstreamsleicester_city_vs_liverpool_live/
https://www.reddit.com/r/topsprotslive/comments/jywcvf/offitialsleicester_city_vs_liverpool_live/
https://www.reddit.com/r/topsprotslive/comments/jywcvs/officiallivestream_leicester_city_vs/
https://www.topsearch123.com/link/830964/official-eagles-vs-browns-live-streams-reddit-nfl_wk11streams
https://www.topfind88.com/post/904179/official-livestream-eagles-vs-browns-live-streams-reddit-nfl_wk11streams
http://www.4mark.net/story/2831575/!-stream-official-2020eagles-vs-browns-live-stream-reddit
https://caribbeanfever.com/photo/albums/sfdvdv
http://millionairex3.ning.com/profiles/blogs/fsdcvdfg
http://korsika.ning.com/profiles/blogs/efsdcvdv
http://facebookhitlist.com/profiles/blogs/htfbfhhb
http://mcdonaldauto.ning.com/profiles/blogs/gdsvfdbgb
https://paste.ee/p/lFq7j
https://www.maiyro.com/posts/xlt3e9
https://ideone.com/7CtMD7
https://paiza.io/projects/43VXU93rVJPf76wC2a2R1g?language=php
https://jsfiddle.net/f8tbv4an/
https://pasteio.com/xTRQQVkW8yfA
http://www.myslimfix.com/profiles/blogs/gsdzcvdfvgfb
https://pastelink.net/29xrx
https://blog.goo.ne.jp/ghjdflo/e/d54baeb04abb19b7bc4066cd19485cee
https://bikashwcxh.tumblr.com/post/635494820923785216/dfhxvfd-fdxfdvdfv
https://paste.by/GutZ1cXMEG
https://paste.feed-the-beast.com/view/fc919e98
http://paste4btc.com/AAGVMpQC
https://www.milesplit.com/discussion/170847
https://www.posts123.com/post/904182/official-livestream-2020eagles-vs-browns-live-streams-reddit-nfl_wk11streams
https://slexy.org/view/s2owXvmuTu
https://ideone.com/syzSD9
https://paiza.io/projects/2ocoJHiBFiaBR0FeoR90RQ?language=php
https://notes.io/MZ6E
http://www.4mark.net/story/2831625/%3E%3Eeagles-vs-browns-2020-live-stream-reddit
https://medium.com/@kkjivfvnht/andhra-pradeshs-covid-19-tally-rises-to-862-000-with-1-121-fresh-cases-eb30a2de6bb0
https://medium.com/@kkjivfvnht/europe-announces-return-of-resrictions-amid-coronavirus-surge-bf4708766a72
https://medium.com/@fggfjhfghj/hospitals-brace-for-covid-surge-fearing-shortages-burnout-9cabf49f9072

Writer & Front-end Software Engineer, Mentor at MyJobGlasses, a teacher at SuperProf & mother of 4 cats. I love learning, sharing what I know and help people.

Follow

Your journey starts here.

Writer & Front-end Software Engineer, Mentor at MyJobGlasses, a teacher at SuperProf & mother of 4 cats. I love learning, sharing what I know and help people.

Exposed!

I started my journey 4 years ago as a software engineer. I’m known as an enthusiast, always smiling girl and a developer with high potential. I had a lot of energy. I still do. Being passionate and finding the ground where I can play and realize my dreams gave me energy and boosted me every day.

I was happy!

I have to admit that the difference between reality and expectations was so big. I had to swallow the capsule, as we say in French.

I had mainly two challenges every day:

  • Do better since I’m a foreigner.
  • Do better in a male environment.

There are always bugs in applications. That’s why debugging skills are essential, and every tool to accelerate this process would be welcomed, Nah?

In this article, I’m going to expose my debugging strategies. They are mainly based on my own experience. Next, I’ll list the tools I usually use. And finally a bonus

Feel free to let me feedback to enrich those thoughts and tools in the comments section ;)

Ready, let’s go!

Debugging strategies

What’s going wrong?

Determining what’s the problem is already half of the solution. You need to understand the problem and have a clear idea in your head. Is it an error when triggering an event? …

--

--

--

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Explore the possibilities with hundreds of domain extensions — {link} -

The Effect of FPS, Resolution and Bitrate Settings on the Resulting Throughput in the Adobe Flash…

DHT1 Temperature Sensor Library for the Raspberry Pico

CS373 Fall 2020: Sujoy Purkayastha

Nest Multi-Speed Fan Support

PokéProject: Adventures with LEGO Bricks

From Button to Voice

Kick-ass GSA SER VPS

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Justobhasi

Justobhasi

More from Medium

Debugging with Angular 9

Angular with clean URL’s using Apache’s mod_rewrite

What is AngularJS and Angular ?

Error Property ..