Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular 2 - building "dist" for production using "npm", and not "ng build -prod"

I have a project that I am building and running with npm start instead of ng serve. I am an angular 2 beginner, so I don't know how to build this project for production, in order to have the dist/ folder with pure javascript/html/css in it. For ng init - created angular 2 apps, if I use ng command, I can just do ng build --prod when work is done and the dist folder is created. If I use ng build --prod on this project, angular is offering me to overwrite some of my files (app.module.ts, app.component.ts, etc....) which I don't want overwritten. There are routing things inside and I don't want to change them. How can I have the production version of this app (ie. the dist/ folder) without using the ng build --prod command? Angular-cli version is:

angular-cli: 1.0.0-beta.28.3
like image 635
Vladimir Despotovic Avatar asked Oct 27 '25 10:10

Vladimir Despotovic


1 Answers

I think you should use @angular/cli instead of angular-cli :

npm install -g @angular/cli

when I use ng build --prod there is no such a problem.

like image 158
El houcine bougarfaoui Avatar answered Oct 29 '25 23:10

El houcine bougarfaoui



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!