Skip to content

Commit 5078c8b

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.
1 parent 4121c8f commit 5078c8b

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
@@ -439,7 +439,10 @@ export async function* serveWithVite(
439439
componentStyles,
440440
templateUpdates,
441441
browserOptions.loader as EsbuildLoaderOption | undefined,
442-
browserOptions.define,
442+
{
443+
...browserOptions.define,
444+
'ngHmrMode': browserOptions.templateUpdates ? 'true' : 'false',
445+
},
443446
extensions?.middleware,
444447
transformers?.indexHtml,
445448
thirdPartySourcemaps,

0 commit comments

Comments
 (0)