Skip to content

bug: Components with scoped: true and rendered in Angular ngmodules do not display any classes #6439

@glehm

Description

@glehm

Prerequisites

Stencil Version

4.20.0

Current Behavior

When a Stencil component is compiled with scoped: true and used within an Angular application (via NgModule), no CSS classes are applied to the element in the DOM.
The component is rendered visually, but all internal classes generated by Stencil are removed.
This causes the styles defined in the component's .scss or .css file not to be displayed.

Expected Behavior

The CSS classes generated by Stencil should be applied normally to the element, even when scoped: true is enabled.
The expected behavior is that the component preserves its internal classes and displays the defined styles, exactly as happens when scoped: false or shadow: true.

System Info

System: node 22.20.0
    Platform: darwin (24.6.0)
   CPU Model: Apple M4 (10 cpus)
    Compiler: [.....]node_modules/@stencil/core/compiler/stencil.js
       Build: 1759440611
     Stencil: 4.38.0 🎿
  TypeScript: 5.5.4
      Rollup: 4.34.9
      Parse5: 7.2.1
      jQuery: 4.0.0-pre
      Terser: 5.37.0

Steps to Reproduce

Create a Stencil component configured with the scoped: true property.

Build the Stencil library as usual.

Import the generated package into an Angular application and register the custom elements in the AppModule.

Render the Stencil component within an Angular template.

Run the Angular application and inspect the rendered element in the browser.

Observe that, when the component has scoped: true, no CSS classes are present in the component.

Image Image

Code Reproduction URL

https://github.com/stenciljs/core

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions