Builds and serves an application, rebuilding on file changes.
serve command is a built-in alias to the run command.
These two commands are equivalent:
nx serve <project> [options]
nx run <project>:serve [options]
nx package globally to invoke the command directly using
nx, or use
npm run nx or
nx serve myapp
The options below are common to the
serve command used within an Nx workspace. The Web and Angular-specifc serve options are listed after these options.
This option allows you to whitelist services that are allowed to access the dev server.
Host to listen on.
Whether to reload the page on change, using live-reload.
Open the application in the browser.
Port to listen on.
Public URL where the application will be served
Serve using HTTPS.
SSL key to use for serving HTTPS.
SSL certificate to use for serving HTTPS.
Watches for changes and rebuilds application
Show version number
Target which builds the application
Memory limit for type checking service process in MB.
Number of workers to use for type checking.
Build using Ahead of Time compilation.
Base url for the application being built.
Target to serve.
EXPERIMENTAL Output file path for Build Event Protocol events.
Use a separate bundle containing code used across multiple bundles.
A named build target, as specified in the "configurations" section of the workspace configuration.
Each named target is accompanied by a configuration of option defaults for that target.
Setting this explicitly overrides the
URL where files will be deployed.
Don't verify connected clients are part of allowed hosts.
Output in-file eval sourcemaps.
Enable hot module replacement.
Show a warning when the
--hmr option is enabled.
Enables optimization of the build output.
Enable and define the file watching poll time period in milliseconds.
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.
Log progress to the console while building.
Proxy configuration file.
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.
The pathname where the app will be served.
Show a warning when deploy-url/base-href use unsupported serve path values.
Use a separate bundle containing only vendor libraries.
Resolve vendor packages sourcemaps.
Adds more details to output logging.