Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Pomax authored Sep 26, 2023
1 parent f87d800 commit 7e8ae1d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ I don't have a good answer to that. Those are some great projects, you probably

By first remembering that bundling was born out of JS not having a module system, where we needed to deliver code in a way that required a single `<script>` element instead of tens or even hundreds of script tags that all had to load in a specific order - an order that could not be guaranteed so needed _additional_ code to manage execution dependencies. Bundling solved that problem, but at a terrible price: it broke browser caching. Your well organized code consisting of individual files for each role was now a single, megabyte-plus monster file and if you needed to change even a single letter, you'd invalidate the cache entry for that entire bundle. Chunking tried to solve that, but was a classic "deal with the symptom instead of addressing the problem" solution. The real solution landed quite a while ago now: _JS got its own module system_ called ES modules, often just referred to as "ESM", and every single browser on the market supports it. Bundling has not been necessary since the summer of 2022, when Microsoft finally killed off the Internet Explorer line of browsers, removing the last reason people still had for using things like Browserify or Webpack (and really, it hasn't been necessary since a few years prior, because plenty of sites had the luxury of just not bothering to support IE once Edge was available concurrently, because even Microsoft was vocal about the fact that IE was going to get killed off for being hopelessly out of date and incompatible with the web).

This is something you should give serious thought to: bundling is a legacy practice, and if your codebase permits it, stop bundling. You don't need to, and your pages and even web apps will be more performance if you don't.
*This is something you should give serious thought to: bundling is a legacy practice, and if your codebase permits it, stop bundling. You don't need to, and your pages and even web apps will be more performant if you don't.*

Second, if you're somehow still stuck with "needing" to bundle, consider switching to [esbuild](https://esbuild.github.io), which is remarkably straight forward to switch to from webpack, even with complex configurations, and puts your project on a modern and both (_much_) faster and better documented bundler instead. JS tooling like formatters, bundlers, and minifiers should not themselves be written _in_ JS.

Expand Down

0 comments on commit 7e8ae1d

Please sign in to comment.