DEV Community

Discussion on: Why our websites are slow — Importance of bundle size

Collapse
 
macdonst profile image
Simon MacDonald

I agree 100% with this comment by Robin and their follow-up comments. At the risk of being combative, I think your initial premise is a bit flawed.

Not Reactjs, not a framework or the servers, or API, nor the internet is the reason behind it.

You have correctly identified that large bundle sizes are the cause of slow applications but not the root cause of why bundle sizes are so large in modern web applications. The reason behind large bundles is the frameworks we've turned to improve developer experience have worsened user experience.

Over the past 5 years, while we were all busy working with JS frameworks, the platform got really, really good. The best way to reduce bundle sizes is not to immediately reach for a framework but instead progressively enhance our applications with JS when needed.

Collapse
 
shreyvijayvargiya profile image
shrey vijayvargiya

Yes, the packages have evolved a lot, webpack mostly handle all the required things such as code-splitting, removing dead-code, lazy loading and so on.

Well, my initial premise have no intention to blame frameworks and langugaes behind the lagging of websites. In fact, I've mentioned them to give combat the blames react often get nowadays about being a bit slow on browser.

Thread Thread
 
macdonst profile image
Simon MacDonald

When I said:

Over the past 5 years, while we were all busy working with JS frameworks, the platform got really, really good.

I meant the web browser itself has vastly improved. To me, the best way to keep your bundle size small is not to immediately reach for a framework but instead start with HTML and CSS, only adding in JS when you absolutely need to. If you want an example, I wrote a post that starts as a React app for collecting data via a from and we strip away what isn't needed until we are left with HTML and CSS only.

blog.begin.com/posts/2022-02-09-do...