9

I am new in angular 2, I want to know how to build my angular 2 app without using CLI for production.

Thanks in Advance.

DAIRAV
  • 723
  • 1
  • 9
  • 31
Shiva
  • 192
  • 1
  • 1
  • 12

2 Answers2

4

If you have used CLI for your existing application You can migrate from Angular CLI to Webpack and tweak it accordingly for (local, development, production). Since Angular CLI v1.0 there’s the “eject” feature, that allows you to extract thewebpack config file and manipulate it as you wish.

Run ng eject so Angular CLI generates the webpack.config.js file.
Run npm install so the new dependencies generated by CLI are satisfied
Refer this Angular CLI to webpack
if you don't want to use CLI at all Refer This An Angular 2 Webpack setup for development and production and Webpack: An Introduction

Vikas
  • 11,859
  • 7
  • 45
  • 69
  • Thanks Vikas, I think this can help. – Shiva Apr 18 '18 at 06:21
  • You're welcome!! Can you make it as correct answer if that's what you were looking for? – Vikas Apr 18 '18 at 06:24
  • Note that to use eject you have to use the version 1.7 of the CLI – Nino Filiu Dec 24 '18 at 13:21
  • Sadly, this answer is no longer correct since the eject feature has been removed long ago. I do not know an easy way to do this yet, it seems the Angular team is solely focused on Angular CLI and Bazel right now. – adlr0 Jul 15 '19 at 10:46
  • I have included a second link too where you can use webpack config, I will modify the answer soon – Vikas Jul 15 '19 at 11:03
3

If you want to go without Angular CLI

  1. Do create all the required thing by yourself, and that is very difficult task
  2. you should go here : https://github.com/angular/quickstart , download quickstart project and start work

But I strongly suggest go with CLI as there it support end to end activity i.e. project start till deployment project

Pranay Rana
  • 175,020
  • 35
  • 237
  • 263
  • For Some region I do not want to use angular 2 cli, I am doing the which you suggest but problem is I want to build it for production, in angular 2 official doc using cli to build it (ng build --prod) – Shiva Apr 18 '18 at 06:10