2017-03-23 17:25:30 -07:00

4.6 KiB

ng serve

Overview

ng serve builds the application and starts a web server.

All the build Options are available in serve, below are the additional options.

Options

host

`--host` (alias: `-H`) _default value: localhost_

Listens only on localhost by default.

hmr

`--hmr` _default value: false_

Enable hot module replacement.

live-reload

`--live-reload` (alias: `-lr`) _default value: true_

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

live-reload-client

`--live-reload-client`

Specify the URL that the live reload browser client will use.

open

`--open` (alias: `-o`) _default value: false_

Opens the url in default browser.

port

`--port` (alias: `-p`) _default value: 4200_

Port to listen to for serving.

ssl

`--ssl`

Serve using HTTPS.

ssl-cert

`--ssl-cert` (alias: `-`) _default value: _

SSL certificate to use for serving HTTPS.

ssl-key

`--ssl-key`

SSL key to use for serving HTTPS.

aot

`--aot`

Build using Ahead of Time compilation.

base-href

`--base-href` (alias: `-bh`)

Base url for the application being built.

deploy-url

`--deploy-url` (alias: `-d`)

URL where files will be deployed.

environment

`--environment` (alias: `-e`)

Defines the build environment.

extract-css

`--extract-css` (alias: `-ec`)

Extract css from global styles onto css files instead of js ones.

i18n-file

`--i18n-file`

Localization file to use for i18n.

i18n-format

`--i18n-format`

Format of the localization file specified with --i18n-file.

locale

`--locale`

Locale to use for i18n.

output-hashing

`--output-hashing` (alias: `-oh`) _default value: _

Define the output filename cache-busting hashing mode. Possible values: `none`, `all`, `media`, `bundles`

output-path

`--output-path` (alias: `-op`) _default value: _

Path where output will be placed.

poll

`--poll`

Enable and define the file watching poll time period (milliseconds) .

progress

`--progress` (alias: `-pr`) _default value: true_

Log progress to the console while building.

sourcemap

`--sourcemap` (alias: `-sm`, `sourcemaps`)

Output sourcemaps.

target

`--target` (aliases: `-t`, `-dev`, `-prod`) _default value: development_

Defines the build target.

vendor-chunk

`--vendor-chunk` (aliases: `-vc`) _default value: true_

Use a separate bundle containing only vendor libraries.

verbose

`--verbose` (aliases: `-v`) _default value: false_

Adds more details to output logging.

watch

`--watch` (aliases: `-w`)

Run build when files change.

Note

When running ng serve, the compiled output is served from memory, not from disk. This means that the application being served is not located on disk in the dist folder.