r/angularjs • u/[deleted] • Apr 10 '16
Webpack - The Confusing Parts
https://medium.com/@rajaraodv/webpack-the-confusing-parts-58712f8fcad9#.ol1oml5de1
u/AlGoreBestGore Apr 10 '16
I tried looking into Webpack before and was confused. This article didn't really help with clearing stuff up, like:
Does this fetch the modules async?
If it does, how does that work with Angular 1 apps?
Does it bundle the CSS together with the JS (at least that's what I took out of their docs)?
Does it work with non-Node backends?
2
Apr 10 '16
All good questions. Here are my answers:
1 Nope.
2 It's not required for Angular 1, unless you are writing it in ES6.
3 Nope. CSS will be either injected into the index.html inside a <script> tag or it generates a single stylesheet and injects a <link> to it.
4 Yes. Webpack itself needs node but your app can have non-node backend (see publicPath instructions in the blog). HTH
1
Apr 10 '16
It can be still used for angular 1. For example, you can do:
angular.component('myComponent', { template: require('./user/profile.html'); controller: function() { ... } })and WebPack will package your HTML file inside your .js bundle.
2
u/PabloHidalgo Apr 10 '16
I have enjoyed your article. When I first meet Webpack, I feel the same as yours, and it took me a bit to start understanding how it worked. Your article have helped me giving some light on a few concepts I didnt fully understand.
You know if its possible to pipe in on dev-mode some extra express middlewares? (I was thinking about json-server in concrete - https://github.com/typicode/json-server )
Thanks!!!
1
u/TotesMessenger Apr 10 '16
0
1
u/[deleted] Apr 10 '16
Article link is broken...