-
Notifications
You must be signed in to change notification settings - Fork 13.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bug: Error with adoptedStyleSheets in Angular 18 and Ionic project #29593
Comments
I am experiencing the same issue on Angular 15. While I can run my app successfully, attempting to run unit tests (jasmine/karma) results in the abovementioned error Ionic InfoIonic: Ionic CLI : 7.1.1 (C:\Users\505449\AppData\Roaming\npm\node_modules@ionic\cli) Capacitor: Capacitor CLI : not installed Utility: cordova-res : not installed globally System: NodeJS : v22.1.0 (C:\Program Files\nodejs\node.exe) |
I believe I have located the source of the issue. The version of stencil/core that ionic relies on appears to be the issue. Apparently this happens if you run the app in an iFrame (like when testing with karma), unclear if it is also the case in other situations. For me, adding It seems the issue first appears in |
Thank you @ConnorBrennan for confirming this issue. I would also like to ask if you could like the bug report so that it gets more attention. I can confirm that the proposed workaround prevents the error from occurring. I look forward to an official fix. I have the impression that Stencil, in general, is a huge blocker when it comes to keeping up with the latest Angular versions. |
I ran into a similar issue. After upgrading from ionic v7 to v8 some of my jest unit tests are broken: TypeError: Cannot read properties of undefined (reading 'includes')
The above mentioned Workaround with the older stencil Version 4.18.1 is fixing the issue for me. I created a repository with code-example here: https://github.com/Floscho2402/ionic-8-jest-issue |
Hey everyone 👋 appreciate the issue and workarounds posted to help out others facing this issue. That's what makes this community awesome! I spoke with the Stencil team and they have isolated the changes causing this regression. I'll track this issue as external to Stencil. The Ionic Framework team will follow up with a dev-build or a resolution when a new build is available. Thanks! |
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out. |
Prerequisites
Ionic Framework Version
v8.x
Current Behavior
I'm encountering an error related to adoptedStyleSheets in my Angular 18 and Ionic project. The console shows the following error:
TypeError: Failed to set the 'adoptedStyleSheets' property on 'Document': Failed to convert value to 'CSSStyleSheet'.
Expected Behavior
The application should run without any errors related to
adoptedStyleSheets
.Steps to Reproduce
Code Reproduction URL
https://github.com/papastepano/try-ionic
Ionic Info
Ionic:
Ionic CLI : 7.2.0 (C:\Users\DELL\AppData\Roaming\npm\node_modules@ionic\cli)
Ionic Framework : @ionic/angular 8.2.1
@angular-devkit/build-angular : 18.0.3
@angular-devkit/schematics : 18.0.3
@angular/cli : 18.0.3
@ionic/angular-toolkit : 11.0.1
Utility:
cordova-res : not installed globally
native-run : not installed globally
System:
NodeJS : v20.11.0 (C:\Program Files\nodejs\node.exe)
npm : 10.4.0
OS : Windows 10
Additional Information
I suspect this might be due to browser compatibility or an issue with how CSSStyleSheet is being used in the project. Any insights or fixes would be appreciated.
Feel free to create a PR to the repo if you have a suggestion
The text was updated successfully, but these errors were encountered: