Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

angular 2 - ng build vs webpack build

I am looking to see what is the best approach to buid and deploy my angular 2 web application?

I finally need to serve it as a web bundle resource to my dropwizard application.

  1. I am trying to understand if I should retain ng build and use that to generate my dist folder or should I override that with webpack and carry out whatever is specified in https://angular.io/guide/webpack .

  2. Does ng build internally call webpack? if yes, is there any benefit in setting up my own webpack-config file and setting it up as discussed in https://angular.io/guide/webpack .

like image 885
serah Avatar asked Jul 21 '17 14:07

serah


2 Answers

angular cli use webpack in the current version and you can config your builds using this command

 ng eject

more info here https://github.com/angular/angular-cli/wiki/eject with this command your webpack configuration file will appear and you can customnize.

like image 128
Mauricio De La Quintana Avatar answered Sep 23 '22 05:09

Mauricio De La Quintana


Webpack and ng-build do pretty much the same job, which is bundling your modules to be used in a browser environment For example, the Angular module is a feature, which doesn't support in the browser, and ES 6 modules are not implemented in any browser yet, which is why things need to be bundled.

like image 37
mekala goutham budda dev Avatar answered Sep 25 '22 05:09

mekala goutham budda dev