bug: Stencil Library doesnt work with Next Js Pages routing
Prerequisites
- [X] I have read the Contributing Guidelines.
- [X] I agree to follow the Code of Conduct.
- [X] I have searched for existing issues that already report this problem, without success.
Stencil Version
4.0.0
Current Behavior
Im integrating a Stencil library with a NextJs application.
Altough it seems to work fine with the new App Routing, when using the Pages route structure, the component cannot be shown receiving the following error:
TypeError: Cannot read properties of undefined (reading '$instanceValues$')
One interesting thing is that if I remove all the props, the component works.
Expected Behavior
Stencils libraries should work on App routing and Pages routing
System Info
System: node 16.17.0
Platform: darwin (22.6.0)
CPU Model: Apple M1 Pro (10 cpus)
Compiler: /Users/brunnohofmann/stencilbug/stencil-library/node_modules/@stencil/core/compiler/stencil.js
Build: 1695049867
Stencil: 4.3.0 🐫
TypeScript: 5.1.6
Rollup: 2.42.3
Parse5: 7.1.2
Sizzle: 2.42.3
Terser: 5.19.4
Steps to Reproduce
I create this repository with a empty stencil library and a next js application. https://github.com/brunnohofmann/stencil_next_js_bug
-
Clone the repo
-
Follow read-me
-
Open the next-js running application.
-
Go to / url - Stencil component should work
-
Go to /test - Stencil component it not visible
-
Try removing all the props from stencil component
-
Build, Install and Run again
-
Stencil component is working on any url
Code Reproduction URL
https://github.com/brunnohofmann/stencil_next_js_bug
Additional Information
No response
Enabling import inject fixed the problem.
stencil.config.ts
extras: {
enableImportInjection: true
}