Thanks for taking the time to reply!
I think I understand webpack a little better now, but what I’m a little unclear about is why we need to use a bundler at all with phoenix apps.
If my understanding is correct, SPA apps send a big blob of JS to the client, which once parsed and initialized creates markup, and handles everything client-side. So, it makes sense for them to pack everything into a single app.js and send when the page first loads.
In phoenix though, everything is handled on the server, so I’m confused as to why we’re sending the whole app.js bundle on each page load. It’s not like we send all our HTML each page load, we only send the layout and what’s required for that page to render, why not do the same with JS? Load common libraries in the layout template and load page specific js in their respective templates.
I feel like I’m missing something obvious, but not sure what it is.


















