[[Code splitting]] allows you to then take advantage of 'lazy loading'. When the user requires some code from your app, e.g. through a page route or button click, you can load the required code on-demand. The overall amount of code isn't reduced, but you've avoided loading code unnecessarily, as well as optimised the initial load.
Lazy loading can now be done natively with the loading="lazy"
[[html]] attribute. Previously, a method like IntersectionObserver or other event handlers would need to be used.
Note that loading="eager"
is the same as not including the attribute.
[[buildtooling]] [[deployment]] [[performance]] [[rendering]] [[web]]