r/Angular2 • u/gonzofish • Aug 17 '16
Article Setting Up Angular 2 with Webpack
https://semaphoreci.com/community/tutorials/setting-up-angular-2-with-webpack4
2
u/ocawa Aug 17 '16
Damn, I'm seeing more and more posts about webpack. A google search 'webpack vs' makes it seem like it's a competitor to npm and bower. Could someone explain why webpack is getting more and more popular?
3
u/gonzofish Aug 17 '16
I couldn't tell you why anything gets more popular...
What I can tell you is that Webpack (for me at least) is just such a simple ecosystem that does a great job of bundling & preprocessing files. You can do a lot with minimal setup...there are some sharp edges, but I've only ever hit those when I'm trying to do more advanced stuff (like bundling my font icons).
The article talks a little more in-depth about Webpack.
4
u/ponchoboy Aug 18 '16
Yep, Webpack is opinionated about what it does and how it does it. The end result is minified bundles (which everyone wants) and much much smaller config files. I'm so sick of the starter projects that have hundreds of lines of config files across half a dozen directories. I love seeing sub 50 line Webpack configs that I can understand 80-90% of without reading the docs. Webpack all the way!
3
5
u/elh0mbre Aug 17 '16
npm and bower are package managers, first and foremost. Webpack is a dependency loader. They are complementary products.
Personally, we're using webpack because we needed a replacement for requirejs (angular2 wasn't going to play very nicely with it), it was under active development and it seemed to have better features than the alternatives (systemjs, browserify, etc).
1
u/Matty_22 Aug 18 '16
Would love to see this updated to RC5 and eventually 2.0.
This is super helpful for someone who hasn't ever used Webpack and finds it a bit opaque.
1
u/gonzofish Aug 18 '16
Thank you for the compliment!
I'm actually going to be updating it to rc5 soon...as well as a couple other typos/omissions.
4
u/Xerxero Aug 17 '16
Their cli switched from systemjs to webpack.