Which @angular/* package(s) are the source of the bug?
router
Is this a regression?
Yes
Description
We updated from Angular 22.0.5 to 22.1.6 and our initial bundle jumped from ~480 kB to ~555 kB, over the 500 kB CLI budget. We don't use router resources (withRouterResources()) anywhere in the app.
Bisected it patch by patch: 22.1.3 is fine (202 kB initial, just main+styles), 22.1.4 already has the jump (553 kB). So it's one of the router-resources commits that landed in 22.1.4 (cherry-picked from df83a340 and fa2aca96).
Traced it to provide_router.ts, which has a new top-level import:
import {createResourceOutletBindingEffects} from './router_resource';
That function is only used inside withRouterResources(), which is opt-in. But router_resource.ts itself has two module-level Symbol() calls with no @__PURE__ hint:
export const BLOCKING_SYMBOL: unique symbol = Symbol(
typeof ngDevMode === 'undefined' || ngDevMode ? '__isBlocking' : '',
);
export const SOURCE_RESOURCE_SYMBOL: unique symbol = Symbol(
typeof ngDevMode === 'undefined' || ngDevMode ? '__sourceResource' : '',
);
Without that hint esbuild treats the file as having a side effect and can't drop it, so the whole module (plus everything it pulls in — Router, effect, computed, resourceFromSnapshots, ...) ends up in the initial bundle. provide_router.ts is always eager since it's called from provideRouter(), so every app pays for this whether it uses router resources or not.
The fix looks pretty small — shared.ts in the same package already does this correctly for the same kind of symbol:
export const RouteTitleKey: unique symbol = /* @__PURE__ */ Symbol('RouteTitle');
so router_resource.ts just seems to be missing the same annotation on its two symbols.
Checked main too, the annotation is still missing there, so this isn't limited to the 22.1.x line.
Please provide a link to a minimal reproduction of the bug
No minimal repro repo, but it's easy to check: ng new a routed app, build it once pinned to 22.1.3 and once to 22.1.4 (core/cli/cdk/build all pinned), and compare the "Initial total" line from ng build. Neither build calls withRouterResources().
Please provide the exception or error you saw
No exception, just the CLI budget warning (bundle initial exceeded maximum budget).
Please provide the environment you discovered this bug in (run ng version)
Angular: 22.1.4, 22.1.5, 22.1.6 (all affected, verified by bisecting patch releases)
Node: 24.18.0
Anything else?
Confirmed the missing @__PURE__ is still absent on main, so this isn't limited to the 22.1.x line.
Which @angular/* package(s) are the source of the bug?
router
Is this a regression?
Yes
Description
We updated from Angular 22.0.5 to 22.1.6 and our initial bundle jumped from ~480 kB to ~555 kB, over the 500 kB CLI budget. We don't use router resources (
withRouterResources()) anywhere in the app.Bisected it patch by patch: 22.1.3 is fine (202 kB initial, just main+styles), 22.1.4 already has the jump (553 kB). So it's one of the router-resources commits that landed in 22.1.4 (cherry-picked from
df83a340andfa2aca96).Traced it to
provide_router.ts, which has a new top-level import:That function is only used inside
withRouterResources(), which is opt-in. Butrouter_resource.tsitself has two module-levelSymbol()calls with no@__PURE__hint:Without that hint esbuild treats the file as having a side effect and can't drop it, so the whole module (plus everything it pulls in —
Router,effect,computed,resourceFromSnapshots, ...) ends up in the initial bundle.provide_router.tsis always eager since it's called fromprovideRouter(), so every app pays for this whether it uses router resources or not.The fix looks pretty small —
shared.tsin the same package already does this correctly for the same kind of symbol:so
router_resource.tsjust seems to be missing the same annotation on its two symbols.Checked
maintoo, the annotation is still missing there, so this isn't limited to the 22.1.x line.Please provide a link to a minimal reproduction of the bug
No minimal repro repo, but it's easy to check:
ng newa routed app, build it once pinned to 22.1.3 and once to 22.1.4 (core/cli/cdk/build all pinned), and compare the "Initial total" line fromng build. Neither build callswithRouterResources().Please provide the exception or error you saw
No exception, just the CLI budget warning (
bundle initial exceeded maximum budget).Please provide the environment you discovered this bug in (run
ng version)Angular: 22.1.4, 22.1.5, 22.1.6 (all affected, verified by bisecting patch releases)
Node: 24.18.0
Anything else?
Confirmed the missing
@__PURE__is still absent onmain, so this isn't limited to the 22.1.x line.