Angular-cli: is ng serve --prod a good choice for deployement ?

Created on 7 Mar 2017  路  7Comments  路  Source: angular/angular-cli

is ng serve --prod an alternative to expressjs configuration to deploy angular 2 apps ?

Most helpful comment

@amineparis both @grizzm0 & @deebloo are correct, you do not want to use ng serve in production even if you use the --prod flag.

The reason that flag exists is to mimic the compilation steps of a production build in a dev environment locally to ease your development process if you so desire.

Summary: use ng serve for development with or without --prod and use a production ready web server for deployments.

All 7 comments

ng serve uses webpack-dev-server which is a development server and not suited for production.

do I need to define my own expressjs configuration file ? and why the flag is called prod if it's not suited for production

@amineparis you will need to setup your own web server. It can be anything, node, apache etc.

@amineparis both @grizzm0 & @deebloo are correct, you do not want to use ng serve in production even if you use the --prod flag.

The reason that flag exists is to mimic the compilation steps of a production build in a dev environment locally to ease your development process if you so desire.

Summary: use ng serve for development with or without --prod and use a production ready web server for deployments.

Just wanted to add that you can find some deployment information at https://angular.io/docs/ts/latest/guide/deployment.html

URL changed to https://angular.io/guide/deployment
The link above is broken @filipesilva

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings

Related issues

beeman picture beeman  路  95Comments

elvisbegovic picture elvisbegovic  路  169Comments

slubowsky picture slubowsky  路  107Comments

burdzand picture burdzand  路  100Comments

ankeshdave picture ankeshdave  路  161Comments