Skip to content

bug: Use Component with Mixin in other Stencil Project #6410

@stefanhuber

Description

@stefanhuber

Prerequisites

Stencil Version

4.38.0

Current Behavior

I have built a UI library with StencilJS and used the Mixin feature in one of the UI components. When testing the UI library in isolation the UI components with Mixins work fine. However, after publishing the UI components to a npm package and importing them in another StencilJS project an error related to the buildExtendsTree function appears.

npm run build

> build
> stencil build

[16:19.3]  @stencil/core
[16:19.5]  v4.38.0 🎿
[16:20.5]  build, app, prod mode, started ...
[16:20.5]  transpile started ...

[ ERROR ]  TypeError: Cannot read properties of undefined (reading 'statements') at
           /Users/stefanhuber/Projects/smartcompanion/audioguide-app/node_modules/@stencil/core/compiler/stencil.js:262636:105
           at Array.forEach (<anonymous>) at
           /Users/stefanhuber/Projects/smartcompanion/audioguide-app/node_modules/@stencil/core/compiler/stencil.js:262624:88
           at Array.forEach (<anonymous>) at
           /Users/stefanhuber/Projects/smartcompanion/audioguide-app/node_modules/@stencil/core/compiler/stencil.js:262621:24
           at Array.forEach (<anonymous>) at buildExtendsTree
           (/Users/stefanhuber/Projects/smartcompanion/audioguide-app/node_modules/@stencil/core/compiler/stencil.js:262573:20)
           at mergeExtendedClassMeta
           (/Users/stefanhuber/Projects/smartcompanion/audioguide-app/node_modules/@stencil/core/compiler/stencil.js:262668:16)
           at parseStaticComponentMeta
           (/Users/stefanhuber/Projects/smartcompanion/audioguide-app/node_modules/@stencil/core/compiler/stencil.js:262760:7)
           at visitNode
           (/Users/stefanhuber/Projects/smartcompanion/audioguide-app/node_modules/@stencil/core/compiler/stencil.js:263156:7)

[16:21.2]  build failed in 750 ms

Expected Behavior

Using StencilJS Components with Mixins in other StenilJS projects.

System Info

System: node 22.17.1
    Platform: darwin (24.6.0)
   CPU Model: Apple M1 (8 cpus)
    Compiler: /Users/stefanhuber/Projects/smartcompanion/audioguide-app/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

I have published the UI components library in version 0.5.0, e.g., one UI component (https://github.com/smartcompanion-app/smartcompanion-library/blob/v0.5.0/packages/ui/src/pages/page-stations/page-stations.tsx) uses a Mixin. Within a project, which is consuming the UI components the build fails in the corresponding branch (https://github.com/smartcompanion-app/audioguide-app/tree/update-ui-library). A npm run build would show the error.

Code Reproduction URL

https://github.com/smartcompanion-app/audioguide-app/tree/update-ui-library

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions