{ "id": "cli/serve", "title": "ng serve", "contents": "\n
\n
\n mode_edit\n code\n
\n \n\n\n
\n \n CLI\n
\n\n \n
\n

ng servelink

\n
\n\n\n \n\n
\n \n

Builds and serves your app, rebuilding on file changes.

\n\n \nng serve <project> [options]\n\nng s <project> [options]\n\n\n\n \n\n \n\n

Arguments

\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
ArgumentDescriptionValue Type
<project>\n

The name of the project to build. Can be an application or a library.

\n\n \n
string
\n\n\n \n\n

Options

\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
OptionDescriptionValue TypeDefault Value
\n --allowed-hosts\n \n \n

List of hosts that are allowed to access the dev server.

\n\n \n
array
\n --aot\n \n \n \n

Deprecated: Use the \"aot\" option in the browser builder instead.

\n\n \n \n

Build using Ahead of Time compilation.

\n\n \n
boolean
\n --base-href\n \n \n \n

Deprecated: Use the \"baseHref\" option in the browser builder instead.

\n\n \n \n

Base url for the application being built.

\n\n \n
string
\n --browser-target\n \n \n

A browser builder target to serve in the format of project:target[:configuration]. You can also pass in more than one configuration name as a comma-separated list. Example: project:target:production,staging.

\n\n \n
string
\n --common-chunk\n \n \n \n

Deprecated: Use the \"commonChunk\" option in the browser builder instead.

\n\n \n \n

Generate a seperate bundle containing code used across multiple bundles.

\n\n \n
boolean
\n --configuration\n \n \n

One or more named builder configurations as a comma-separated list as specified in the \"configurations\" section of angular.json.\nThe builder uses the named configurations to run the given target.\nFor more information, see https://angular.io/guide/workspace-config#alternate-build-configurations.\nSetting this explicitly overrides the \"--prod\" flag.

\n\n

Aliases: -c

\n
string
\n --deploy-url\n \n \n \n

Deprecated: Use the \"deployUrl\" option in the browser builder instead.

\n\n \n \n

URL where files will be deployed.

\n\n \n
string
\n --disable-host-check\n \n \n

Don't verify connected clients are part of allowed hosts.

\n\n \n
booleanfalse
\n --help\n \n \n

Shows a help message for this command in the console.

\n\n \n
true|false|json|JSONfalse
\n --hmr\n \n \n

Enable hot module replacement.

\n\n \n
booleanfalse
\n --hmr-warning\n \n \n \n

Deprecated: No longer has an effect.

\n\n \n \n

Show a warning when the --hmr option is enabled.

\n\n \n
booleantrue
\n --host\n \n \n

Host to listen on.

\n\n \n
stringlocalhost
\n --live-reload\n \n \n

Whether to reload the page on change, using live-reload.

\n\n \n
booleantrue
\n --open\n \n \n

Opens the url in default browser.

\n\n

Aliases: -o

\n
booleanfalse
\n --optimization\n \n \n \n

Deprecated: Use the \"optimization\" option in the browser builder instead.

\n\n \n \n

Enables optimization of the build output. Including minification of scripts and styles, tree-shaking, dead-code elimination, tree-shaking and fonts inlining. For more information, see https://angular.io/guide/workspace-config#optimization-configuration.

\n\n \n
boolean
\n --poll\n \n \n

Enable and define the file watching poll time period in milliseconds.

\n\n \n
number
\n --port\n \n \n

Port to listen on.

\n\n \n
number4200
\n --prod\n \n \n \n

Deprecated: Use --configuration production instead.

\n\n \n \n

Shorthand for \"--configuration=production\".\nSet the build configuration to the production target.\nBy default, the production target is set up in the workspace configuration such that all builds make use of bundling, limited tree-shaking, and also limited dead code elimination.

\n\n \n
boolean
\n --progress\n \n \n \n

Deprecated: Use the \"progress\" option in the browser builder instead.

\n\n \n \n

Log progress to the console while building.

\n\n \n
boolean
\n --proxy-config\n \n \n

Proxy configuration file.

\n\n \n
string
\n --public-host\n \n \n

The URL that the browser client (or live-reload client, if enabled) should use to connect to the development server. Use for a complex dev server setup, such as one with reverse proxies.

\n\n \n
string
\n --serve-path\n \n \n

The pathname where the app will be served.

\n\n \n
string
\n --serve-path-default-warning\n \n \n \n

Deprecated: No longer has an effect.

\n\n \n \n

Show a warning when deploy-url/base-href use unsupported serve path values.

\n\n \n
booleantrue
\n --source-map\n \n \n \n

Deprecated: Use the \"sourceMap\" option in the browser builder instead.

\n\n \n \n

Output source maps for scripts and styles. For more information, see https://angular.io/guide/workspace-config#source-map-configuration.

\n\n \n
boolean
\n --ssl\n \n \n

Serve using HTTPS.

\n\n \n
booleanfalse
\n --ssl-cert\n \n \n

SSL certificate to use for serving HTTPS.

\n\n \n
string
\n --ssl-key\n \n \n

SSL key to use for serving HTTPS.

\n\n \n
string
\n --vendor-chunk\n \n \n \n

Deprecated: Use the \"vendorChunk\" option in the browser builder instead.

\n\n \n \n

Generate a seperate bundle containing only vendor libraries. This option should only used for development.

\n\n \n
boolean
\n --verbose\n \n \n

Adds more details to output logging.

\n\n \n
boolean
\n --watch\n \n \n

Rebuild on change.

\n\n \n
booleantrue
\n\n\n \n
\n
\n\n\n" }