2

I had worked on angular 1.x project before where we used bower to manage and install front-end dependencies. We used a gulp build system, in which we used gulp-wiredep to wire up all dependencies in index.html.

Just recently, I have started working on Angular 4.x project and planning out to create a build system with gulp. Is that even possible? I know there are other options available like webpack, angular-cli etc... but is wish to create it using gulp.

My questions is:

  1. How to manage the front-end dependencies?

Earlier when we used gulp, front-end dependencies were managed by bower and we used gulp-wiredep to wire all those up in index.html. But when I searched for Angular 4.x package in bower, I did't find one.

  1. If I use SystemJs as a module loader, do I still have to reference all the js (ts->js) in index.html?

Earlier we had a gulp task which picked up all the js file referenced in index.html and bundled it into one app.js file.

Please help! I understand angular 4.x but I am finding a hard time with a build system.

chirag_lad
  • 229
  • 1
  • 16

1 Answers1

2

How to manage the front-end dependencies?

Use npm for that. Bower is dying.

If I use SystemJs as a module loader, do I still have to reference all the js (ts->js) in index.html?

No, you just have to reference the starting module, usually main.js. Read more here.

But I would strongly recommend to consider webpack/angular-cli for your build system.

Max Koretskyi
  • 101,079
  • 60
  • 333
  • 488
  • Thanks! Could you point me to a repo. if you know any that exists, which uses webpack(config) for a real world angular 4 app? I need it as reference to be able to create my own one in my project. It should handle task of ts->js compilation, minifi. & concat., less to css, vendor prefixes, code analysis, cache busting, – chirag_lad Jun 09 '17 at 06:48
  • @chirag_lad, there are many tutorials on the web, for example [this one](https://angular.io/docs/ts/latest/guide/webpack.html) – Max Koretskyi Jun 09 '17 at 06:54
  • @chirag_lad, please consider upvoting or accepting my answer if it helped, thanks – Max Koretskyi Jun 10 '17 at 04:51