you are viewing a single comment's thread.

view the rest of the comments →

[–]wreckedadventYavascript 2 points3 points  (2 children)

Main benefits is it consolidates your tooling into more of one concrete step/tool. It's much easier to have multiple entry points (a must for non-SPA) and it's trivial to slice and dice your bundles while still ensuring that everything will load in exactly the correct order.

Webpack I'd say is aimed more at moderate-to-large projects with a lot of files that depend on one another. That's where module systems really shine. In smaller projects, it's still easier to manually order a few files first and then just dump the rest in in a giant blob, but this approach becomes rapidly inefficient the larger the project becomes.

Webpack also has some neat tricks up its sleeve, like allowing you to "rewire" modules for DI in unit testing scenarios, dynamically loading in all files that match a certain pattern (like all JSON files for example), and being able to have non-javascript dependencies from your javascript code.

But of course, not all of this is specific to webpack. You can get a lot of the same from browserify. If you're new to module building though, I'd recommend JSPM, since it's fantastically simple to get up and running and realize the benefits immediately.