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.

4
  • what do you mean by without Commented Apr 18, 2018 at 6:00
  • I mean without Angular CLi. with angular cli command ng build --prod which do i want same thing without it. Commented Apr 18, 2018 at 6:05
  • You don't want to use the CLI at all, or just for production? Commented Apr 18, 2018 at 6:09
  • Thanks for replay, I do not want use in my project Commented Apr 18, 2018 at 6:11

2 Answers 2

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

Sign up to request clarification or add additional context in comments.

5 Comments

Thanks Vikas, I think this can help.
You're welcome!! Can you make it as correct answer if that's what you were looking for?
Note that to use eject you have to use the version 1.7 of the CLI
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.
I have included a second link too where you can use webpack config, I will modify the answer soon
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

1 Comment

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)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.