Gonzalo García takes a crack at why webpack (not capitalized like npm) exists at all. No particular disagreements here, but here’s my crack at it…
- We use webpack because we need to
import stuff from place;
. This is a good pattern. We can use webpack to interpret those statements, as native support for them isn’t what it needs to be yet, and it’s not clear whether the native version will be smart for performance or not (probably not, at the scope of projects webpack is usually used for). - We use webpack because we know we need to concatenate and compress our JavaScript anyway, and managing load order isn’t something you wanna handle manually.
- We use webpack because of npm. Powerful features are a
yarn
ornpm i
away and so our projects are loaded with stuff toimport
. - We use webpack because we’re sure it performs fancy magic that results in good performance-related things for our websites. We cross our fingers we have that right, and we’ve done our part right.
- We use webpack because there is a hive mind in this industry and it leads to a lot of us hopping on the trains with the most people on them, and people are hanging out of the windows of the webpack train.
I’m very very (very) far from being a webpack expert, but I essentially get it, especially after the screencast Sean Larkin and I did right here, and I know enough my projects benefit from it.
Direct Link to Article — Permalink
The post Why would I use a Webpack? appeared first on CSS-Tricks.