I am using a Webpack in node.js to compile/bundle the Javascript for a static website. It's a fairly typical setup of multiple smaller JS files that compile into a single "main.js" file used across my site.
Say my Javascript pre-bundle looked like this:
module-a.js (50 kb)
module-b.js (50 kb)
module-c.js (50 kb)
And my site consists of 5 pages;
My understanding is, based on the way Webpack compiles the main.js file, only resources needed from main.js on a page-by-page basis will be utilized and have any sort of performance impact. So on Page 5, main.js would be weightless or close to it (except for the HTTP request for main.js), Page 4 would experience the "full" weight of the package, and the other pages would load in pieces as needed.
Am I correctly understanding this? If so...
Thank you!