@nrwl/angular:webpack-server
The webpack-server executor is very similar to the standard dev server builder provided by the Angular Devkit. It is usually used in tandem with @nrwl/angular:webpack-browser
when your Angular application uses a custom webpack configuration.
Options can be configured in project.json
when defining the executor, or when invoking it. Read more about how to configure targets and executors here: https://nx.dev/configuration/projectjson#targets.
Seving an application with a custom webpack configuration
This executor should be used along with @nrwl/angular:webpack-browser
to serve an application using a custom webpack configuration.
Your project.json
file should contain a build
and serve
target that matches the following:
1"build": {
2 "executor": "@nrwl/angular:webpack-browser",
3 "options": {
4 ...
5 "customWebpackConfig": {
6 "path": "apps/appName/webpack.config.js"
7 }
8 }
9},
10"serve": {
11 "executor": "@nrwl/angular:webpack-server",
12 "configurations": {
13 "production": {
14 "browserTarget": "appName:build:production"
15 },
16 "development": {
17 "browserTarget": "appName:build:development"
18 }
19 },
20 "defaultConfiguration": "development",
21}
Options
allowedHosts
[]
List of hosts that are allowed to access the dev server.
browserTarget
^[^:\\s]+:[^:\\s]+(:[^\\s]+)?$
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
.
buildLibsFromSource
Read buildable libraries from source instead of building them separately. If not set, it will take the value specified in the browserTarget
options, or it will default to true
if it's also not set in the browserTarget
options.
disableHostCheck
false
Don't verify connected clients are part of allowed hosts.
host
localhost
Host to listen on.
hmr
false
Enable hot module replacement.
liveReload
true
Whether to reload the page on change, using live-reload.
open
false
Opens the url in default browser.
port
4200
Port to listen on.
proxyConfig
Proxy configuration file. For more information, see https://angular.io/guide/build#proxying-to-a-backend-server.
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.
poll
Enable and define the file watching poll time period in milliseconds.
ssl
false
Serve using HTTPS.
sslKey
SSL key to use for serving HTTPS.
sslCert
SSL certificate to use for serving HTTPS.
servePath
The pathname where the app will be served.
verbose
Adds more details to output logging.
watch
true
Rebuild on change.