Skip to content

feat(dev-server): hmr config + global CSS hot-swap (#145) - #185

Merged
lukekania merged 1 commit into
milestone/v0.11.0-builder-parityfrom
feat/hmr-config-css-swap
Jun 9, 2026
Merged

feat(dev-server): hmr config + global CSS hot-swap (#145)#185
lukekania merged 1 commit into
milestone/v0.11.0-builder-parityfrom
feat/hmr-config-css-swap

Conversation

@lukekania

Copy link
Copy Markdown
Owner

First slice of Hot Module Replacement (#145): read the hmr flag and hot-swap global stylesheets in place without a full page reload.

Changes

  • project-resolver: parse architect.serve.options.hmr (base + active serve-configuration override) into ResolvedAngularProject.hmr; defaults to false.
  • cli: add --hmr / --no-hmr to serve (CLI wins over angular.json, else inherit, else false). When HMR is on and a rebuild touches only global stylesheet entries, emit a CSS update instead of a reload.
  • dev-server: new DevServerEvent::CssUpdate { timestamp }event: css-update SSE frame; the injected client swaps the styles.css <link> with a cache-busted href, preserving page/component/form state.

Scope

Component template/style HMR and the /@ng/component update endpoint land in the follow-up slices stacked on this branch. Default (hmr: false) keeps today's full-reload behavior unchanged.

Tests

  • project-resolver: hmr default-false, read-from-serve-options, configuration-override.
  • dev-server: css-update SSE frame shape; injected client subscribes to css-update and does not reload.
  • cli: CSS-only change classification.

Part of the v0.11.0 builder-parity milestone; targets the milestone branch. No version bump on sub-branches (bumped once at milestone completion).

First slice of Hot Module Replacement: read the `hmr` flag and hot-swap
global stylesheets in place without a full page reload.

- project-resolver: parse `architect.serve.options.hmr` (base + active
  serve configuration override) into `ResolvedAngularProject.hmr`;
  defaults to false.
- cli: add `--hmr` / `--no-hmr` to `serve` (CLI wins over angular.json,
  else inherit, else false). When HMR is on and a rebuild touches only
  global stylesheet entries, emit a CSS-update instead of a reload.
- dev-server: new `DevServerEvent::CssUpdate { timestamp }` →
  `event: css-update` SSE frame; the injected client swaps the
  `styles.css` <link> with a cache-busted href, preserving page state.

Component template/style HMR and the `/@ng/component` update endpoint
land in follow-up slices on the milestone branch.
@lukekania
lukekania merged commit 43940f7 into milestone/v0.11.0-builder-parity Jun 9, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant