Skip to content

refactor(@angular/build): check that AOT is enabled in HMR logic #30363

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 21, 2025
Merged
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
9 changes: 5 additions & 4 deletions packages/angular/build/src/builders/dev-server/vite-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,14 +158,15 @@ export async function* serveWithVite(
process.setSourceMapsEnabled(true);
}

const componentsHmrCanBeUsed =
browserOptions.aot && serverOptions.liveReload && serverOptions.hmr;

// Enable to support link-based component style hot reloading (`NG_HMR_CSTYLES=1` can be used to enable)
browserOptions.externalRuntimeStyles =
serverOptions.liveReload && serverOptions.hmr && useComponentStyleHmr;
browserOptions.externalRuntimeStyles = componentsHmrCanBeUsed && useComponentStyleHmr;

// Enable to support component template hot replacement (`NG_HMR_TEMPLATE=0` can be used to disable selectively)
// This will also replace file-based/inline styles as code if external runtime styles are not enabled.
browserOptions.templateUpdates =
serverOptions.liveReload && serverOptions.hmr && useComponentTemplateHmr;
browserOptions.templateUpdates = componentsHmrCanBeUsed && useComponentTemplateHmr;
browserOptions.incrementalResults = true;

// Setup the prebundling transformer that will be shared across Vite prebundling requests
Expand Down