Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 33 additions & 3 deletions packages/angular/build/src/builders/dev-server/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,39 @@
"description": "The pathname where the application will be served."
},
"hmr": {
"type": "boolean",
"description": "Enable hot module replacement.",
"default": false
"description": "Disable or configure HMR connection",
"default": false,
"oneOf": [
{
"type": "object",
"properties": {
"protocol": {
"type": "string",
"description": "The WebSocket protocol used for the HMR connection: ws (WebSocket) or wss (WebSocket Secure)."
},
"host": {
"type": "string",
"description": "The IP addresses or domain the HMR server should listen on."
},
"port": {
"type": "number",
"description": "The port the HMR server should listen on."
},
"overlay": {
"type": "boolean",
"description": "Set to false to disable the server error overlay."
},
"clientPort": {
"type": "number",
"description": "An advanced option that overrides the port only on the client side, allowing you to serve the websocket on a different port than the client code looks for it on."
}
},
"additionalProperties": false
},
{
"type": "boolean"
}
]
},
"watch": {
"type": "boolean",
Expand Down
5 changes: 3 additions & 2 deletions packages/angular/build/src/builders/dev-server/vite-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ export async function* serveWithVite(
// TODO: Implement support -- application builder currently does not use
break;
case ResultKind.ComponentUpdate:
assert(serverOptions.hmr, 'Component updates are only supported with HMR enabled.');
assert(!!serverOptions.hmr, 'Component updates are only supported with HMR enabled.');
// TODO: Implement support -- application builder currently does not use
break;
default:
Expand Down Expand Up @@ -430,7 +430,7 @@ async function handleUpdate(
return;
}

if (serverOptions.liveReload || serverOptions.hmr) {
if (serverOptions.liveReload || !!serverOptions.hmr) {
if (updatedFiles.every((f) => f.endsWith('.css'))) {
const timestamp = Date.now();
server.hot.send({
Expand Down Expand Up @@ -613,6 +613,7 @@ export async function setupServer(
open: serverOptions.open,
headers: serverOptions.headers,
proxy,
hmr: serverOptions.hmr,
cors: {
// Allow preflight requests to be proxied.
preflightContinue: true,
Expand Down