Skip to content

Angular Adaptor: widget components must explicitly state standalone: false when declared in an NgModule #111

@brandonbird

Description

@brandonbird

Describe the bug
As of Angular 19 all components are considered standalone: true by default. However, these widget components are not designed to be standalone and instead are declared in the LiveChatWidgetModule.
If you use the components in another module-based component by importing the module you receive this runtime error:

Error: Unexpected "LiveChatWidgetComponent" found in the "declarations" array of the "LiveChatWidgetModule" NgModule, "LiveChatWidgetComponent" is marked as standalone and can't be declared in any NgModule - did you intend to import it instead (by adding it to the "imports" array)?
Unexpected "TextWidgetComponent" found in the "declarations" array of the "LiveChatWidgetModule" NgModule, "TextWidgetComponent" is marked as standalone and can't be declared in any NgModule - did you intend to import it instead (by adding it to the "imports" array)?

Even though Angular considers them standalone by default, if you try to import the component and use it as a standalone you'll get this error:

The component 'TextWidgetComponent' appears in 'imports', but is not standalone and cannot be imported directly. It must be imported via an NgModule.

The component metadata should be updated to explicitly declare standalone: false

To Reproduce
Steps to reproduce the behavior:

  1. Add LiveChatWidgetModule to your AppModule imports, as per the documentation readme example
  2. Add the TextWidgetComponent to your AppComponent, as per the documentation readme example. The App Component should be declared as standalone: false.
  3. Serve the application. The error will display in the console.

Expected behavior
You should be able to run your app without this error.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: MacOS Tahoe 26.3
  • Browser: Chrome
  • Version 45.0.7632.117

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions