Skip to content

Commit e9b29be

Browse files
clydinalan-agius4
authored andcommitted
refactor(@angular/build): remove deprecated Vite node server hot field usage
The `ViteServer` instance's `hot` field is deprecated and will eventually be removed. The `ws` field can be used in its place.
1 parent f630726 commit e9b29be

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

packages/angular/build/src/builders/dev-server/vite-server.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ export async function* serveWithVite(
181181
case ResultKind.Failure:
182182
if (result.errors.length && server) {
183183
hadError = true;
184-
server.hot.send({
184+
server.ws.send({
185185
type: 'error',
186186
err: {
187187
message: result.errors[0].text,
@@ -230,7 +230,7 @@ export async function* serveWithVite(
230230
if (hadError && server) {
231231
hadError = false;
232232
// Send an empty update to clear the error overlay
233-
server.hot.send({
233+
server.ws.send({
234234
'type': 'update',
235235
updates: [],
236236
});
@@ -369,7 +369,7 @@ export async function* serveWithVite(
369369
key: 'r',
370370
description: 'force reload browser',
371371
action(server) {
372-
server.hot.send({
372+
server.ws.send({
373373
type: 'full-reload',
374374
path: '*',
375375
});
@@ -433,7 +433,7 @@ async function handleUpdate(
433433
if (serverOptions.liveReload || serverOptions.hmr) {
434434
if (updatedFiles.every((f) => f.endsWith('.css'))) {
435435
const timestamp = Date.now();
436-
server.hot.send({
436+
server.ws.send({
437437
type: 'update',
438438
updates: updatedFiles.flatMap((filePath) => {
439439
// For component styles, an HMR update must be sent for each one with the corresponding
@@ -468,7 +468,7 @@ async function handleUpdate(
468468

469469
// Send reload command to clients
470470
if (serverOptions.liveReload) {
471-
server.hot.send({
471+
server.ws.send({
472472
type: 'full-reload',
473473
path: '*',
474474
});

0 commit comments

Comments
 (0)