Skip to content

Commit 03a420b

Browse files
committed
refactor(@angular/build): use ngHmrMode define for Vite prebundling
The internal `ngHmrMode` define value was previously available to application code and third-party modules that were not prebundled. To ensure that the value is propagated to all relevant code served by the development server, the `ngHmrMode` define is now used during the Vite prebundling phase. This allows any prebundled dependencies to also leverage the `ngHmrMode` value. The framework may, for instance, use the value to provide additional development time diagnostics. (cherry picked from commit 5078c8b)
1 parent 00cd0d1 commit 03a420b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

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

+4-1
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,10 @@ export async function* serveWithVite(
448448
componentStyles,
449449
templateUpdates,
450450
browserOptions.loader as EsbuildLoaderOption | undefined,
451-
browserOptions.define,
451+
{
452+
...browserOptions.define,
453+
'ngHmrMode': browserOptions.templateUpdates ? 'true' : 'false',
454+
},
452455
extensions?.middleware,
453456
transformers?.indexHtml,
454457
thirdPartySourcemaps,

0 commit comments

Comments
 (0)