Skip to content

TypeError: $localize is not a function after HMR Component update sent to client(s) #59605

@bogui

Description

@bogui

Which @angular/* package(s) are the source of the bug?

localize, compiler-cli

Is this a regression?

Yes

Description

Afer changes on template, the HMR sent to browser does not load (no changes are reflected) and when navigate from that component to another and then back to the changed one it does not show (it's broken) and there is a error message in the dev console (not in the terminal where ng serve is executed). The error says - "ERROR TypeError: $localize is not a function". I have tested it on edge, chrome and firefox (including private mode) - the error shows on all three of them.

Please provide a link to a minimal reproduction of the bug

No response

Please provide the exception or error you saw

core.mjs:20865 Angular is running in development mode.
core.mjs:6672  ERROR TypeError: $localize is not a function
    at consts (partners-table.component.ts:252:28)
    at createTView (core.mjs:13028:58)
    at getOrCreateComponentTView (core.mjs:13003:24)
    at createRootComponentView (core.mjs:17535:47)
    at ComponentFactory.create (core.mjs:17410:25)
    at ViewContainerRef2.createComponent (core.mjs:17825:43)
    at _RouterOutlet.activateWith (router.mjs:2785:31)
    at ActivateRoutes.activateRoutes (router.mjs:3227:28)
    at router.mjs:3183:12
    at Array.forEach (<anonymous>)
    at ActivateRoutes.activateChildRoutes (router.mjs:3182:25)
    at ActivateRoutes.activateRoutes (router.mjs:3233:14)
    at router.mjs:3183:12
    at Array.forEach (<anonymous>)
    at ActivateRoutes.activateChildRoutes (router.mjs:3182:25)
handleError @ core.mjs:6672
next @ core.mjs:35097
ConsumerObserver2.next @ Subscriber.js:90
Subscriber2._next @ Subscriber.js:59
Subscriber2.next @ Subscriber.js:32
(anonymous) @ Subject.js:41
errorContext @ errorContext.js:23
Subject2.next @ Subject.js:31
emit @ core.mjs:6063
(anonymous) @ core.mjs:6558
invoke @ zone.js:369
run @ zone.js:111
runOutsideAngular @ core.mjs:6420
onHandleError @ core.mjs:6558
handleError @ zone.js:373
runGuarded @ zone.js:124
api.microtaskDrainDone @ zone.js:2325
drainMicroTaskQueue @ zone.js:588
invokeTask @ zone.js:487
invokeTask @ zone.js:1138
globalCallback @ zone.js:1169
globalZoneAwareCallback @ zone.js:1202
client:907 [vite] server connection lost. Polling for restart...
client:979  WebSocket connection to 'ws://localhost:4200/' failed: 
ping @ client:979
waitForSuccessfulPing @ client:998
handleMessage @ client:909
onMessage @ client:298
(anonymous) @ client:446
client:979  WebSocket connection to 'ws://localhost:4200/' failed: 
ping @ client:979
waitForSuccessfulPing @ client:1004
client:979  WebSocket connection to 'ws://localhost:4200/' failed: 
ping @ client:979
waitForSuccessfulPing @ client:1004
client:979  WebSocket connection to 'ws://localhost:4200/' failed: 
ping @ client:979
waitForSuccessfulPing @ client:1004
client:979  WebSocket connection to 'ws://localhost:4200/' failed: 
ping @ client:979
waitForSuccessfulPing @ client:1004
client:979  WebSocket connection to 'ws://localhost:4200/' failed: 
ping @ client:979
waitForSuccessfulPing @ client:1004
client:979  WebSocket connection to 'ws://localhost:4200/' failed: 
ping @ client:979
waitForSuccessfulPing @ client:1004
client:979  WebSocket connection to 'ws://localhost:4200/' failed: 
ping @ client:979
waitForSuccessfulPing @ client:1004
client:979  WebSocket connection to 'ws://localhost:4200/' failed: 
ping @ client:979
waitForSuccessfulPing @ client:1004
client:979  WebSocket connection to 'ws://localhost:4200/' failed: 
ping @ client:979
waitForSuccessfulPing @ client:1004
client:979  WebSocket connection to 'ws://localhost:4200/' failed: 
ping @ client:979
waitForSuccessfulPing @ client:1004
client:979  WebSocket connection to 'ws://localhost:4200/' failed: 
ping @ client:979
waitForSuccessfulPing @ client:1004
client:979  WebSocket connection to 'ws://localhost:4200/' failed: 
ping @ client:979
waitForSuccessfulPing @ client:1004
client:979  WebSocket connection to 'ws://localhost:4200/' failed: 
ping @ client:979
waitForSuccessfulPing @ client:1004
client:979  WebSocket connection to 'ws://localhost:4200/' failed: 
ping @ client:979
waitForSuccessfulPing @ client:1004
client:979  WebSocket connection to 'ws://localhost:4200/' failed: 
ping @ client:979
waitForSuccessfulPing @ client:1004

Please provide the environment you discovered this bug in (run ng version)

Angular CLI: 19.1.2
Node: 23.5.0 (Unsupported)
Package Manager: npm 11.0.0
OS: linux x64

Angular: 19.1.1
... animations, common, compiler, compiler-cli, core, forms
... localize, platform-browser, platform-browser-dynamic, router
... service-worker

Package                            Version
------------------------------------------------------------
@angular-devkit/architect          0.1901.2
@angular-devkit/build-angular      19.1.2
@angular-devkit/core               19.1.2
@angular-devkit/schematics         19.1.2
@angular/cdk                       19.1.0
@angular/cli                       19.1.2
@angular/material                  19.1.0
@angular/material-moment-adapter   19.1.0
@schematics/angular                19.1.2
ng-packagr                         19.1.0
rxjs                               7.8.1
typescript                         5.7.3
webpack                            5.97.1
zone.js                            0.15.0
    
Warning: The current version of Node (23.5.0) is not supported by Angular.

Anything else?

This is an old project working well until Angular 19.0 (included). It's mix of standalone components and modules - it's being refactored slowly to standalone.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions