填写这份《一分钟调查》,帮我们(开发组)做得更好!去填写Home

ng serve

Builds and serves your app, rebuilding on file changes.

ng serve <project> [options]
      
      ng serve <project> [options]
    
ng s <project> [options]
      
      ng s <project> [options]
    

参数

参数说明
<project>

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

选项

选项说明
--allowedHosts

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

--aot=true|false

Build using Ahead of Time compilation.

--baseHref=baseHref

Base url for the application being built.

--browserTarget=browserTarget

Target to serve.

--buildEventLog=buildEventLog

EXPERIMENTAL Output file path for Build Event Protocol events

--commonChunk=true|false

Use a separate bundle containing code used across multiple bundles.

--configuration=configuration

A named build target, as specified in the "configurations" section of angular.json. Each named target is accompanied by a configuration of option defaults for that target. Setting this explicitly overrides the "--prod" flag

别名: -c

--deployUrl=deployUrl

URL where files will be deployed.

--disableHostCheck=true|false

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

默认值: false

--evalSourceMap=true|false

Deprecated

Output in-file eval sourcemaps.

--help=
true|false|json|JSON

Shows a help message for this command in the console.

默认值: false

--hmr=true|false

Enable hot module replacement.

默认值: false

--hmrWarning=true|false

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

默认值: true

--host=host

Host to listen on.

默认值: localhost

--liveReload=true|false

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

默认值: true

--open=true|false

Opens the url in default browser.

默认值: false

别名: -o

--optimization=true|false

Enables optimization of the build output.

--poll

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

--port

Port to listen on.

默认值: 4200

--prod=true|false

Shorthand for "--configuration=production". When true, sets the build configuration to the production target. By 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.

--progress=true|false

Log progress to the console while building.

--proxyConfig=proxyConfig

Proxy configuration file.

--publicHost=publicHost

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.

--servePath=servePath

The pathname where the app will be served.

--servePathDefaultWarning=true|false

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

默认值: true

--sourceMap=true|false

Output sourcemaps.

--ssl=true|false

Serve using HTTPS.

默认值: false

--sslCert=sslCert

SSL certificate to use for serving HTTPS.

--sslKey=sslKey

SSL key to use for serving HTTPS.

--vendorChunk=true|false

Use a separate bundle containing only vendor libraries.

--vendorSourceMap=true|false

Deprecated

Resolve vendor packages sourcemaps.

--verbose=true|false

Adds more details to output logging.

--watch=true|false

Rebuild on change.

默认值: true