Description
After updating to the latest thingsboard-extensions (Angular 20), widget extensions build successfully but fail at runtime when using Angular CDK components (for example @angular/cdk/scrolling).
The browser console reports:
ReferenceError: ngDevMode is not defined
The error occurs while ThingsBoard is instantiating the widget extension.
Environment
- Latest
thingsboard-extensions from master
- Angular 20
- Latest ThingsBoard PE (tested with widget extensions)
Steps to reproduce
- Clone the latest
thingsboard-extensions repository.
- Create or use a widget extension that uses Angular CDK (for example
cdk-virtual-scroll-viewport).
- Build the extension.
- Upload the generated widget extension to ThingsBoard.
- Open the widget.
Actual result
The widget fails during initialization with:
ReferenceError: ngDevMode is not defined
Expected result
The widget should initialize normally.
Temporary workaround
Adding the following line at the beginning of the extension entry point fixes the issue:
(globalThis as any).ngDevMode ??= false;
This suggests the extension bundle is executed before the global ngDevMode variable is available.
It would be great if the extension build or loader could initialize this automatically so extension developers do not need to add the workaround manually.
Description
After updating to the latest
thingsboard-extensions(Angular 20), widget extensions build successfully but fail at runtime when using Angular CDK components (for example@angular/cdk/scrolling).The browser console reports:
The error occurs while ThingsBoard is instantiating the widget extension.
Environment
thingsboard-extensionsfrommasterSteps to reproduce
thingsboard-extensionsrepository.cdk-virtual-scroll-viewport).Actual result
The widget fails during initialization with:
Expected result
The widget should initialize normally.
Temporary workaround
Adding the following line at the beginning of the extension entry point fixes the issue:
This suggests the extension bundle is executed before the global
ngDevModevariable is available.It would be great if the extension build or loader could initialize this automatically so extension developers do not need to add the workaround manually.