Skip to content
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

Angular ssr/prerender is broken with 18 #14612

Closed
kdinev opened this issue Aug 4, 2024 · 1 comment · Fixed by #14581
Closed

Angular ssr/prerender is broken with 18 #14612

kdinev opened this issue Aug 4, 2024 · 1 comment · Fixed by #14581
Assignees
Labels
🐛 bug Any issue that describes a bug 📉 regression 🔥 severity: high ✨ themes version: 18.0.x version: 18.1.x ✅ status: resolved Applies to issues that have pending PRs resolving them, or PRs that have already merged.

Comments

@kdinev
Copy link
Member

kdinev commented Aug 4, 2024

Description

With the current version of the components, there's an error when trying to run a pre-render or ssr build.

ERROR TypeError: globalThis.getComputedStyle is not a function
    at i.init (file:///home/runner/work/bellum-gens/bellum-gens/.angular/prerender-root/424d766a-8fe7-4aee-8cc8-349e86681f8e/chunk-CEFPNUAV.mjs:13:49080)
    at new i (file:///home/runner/work/bellum-gens/bellum-gens/.angular/prerender-root/424d766a-8fe7-4aee-8cc8-349e86681f8e/chunk-CEFPNUAV.mjs:13:49049)
    at i.ɵfac [as factory] (file:///home/runner/work/bellum-gens/bellum-gens/.angular/prerender-root/424d766a-8fe7-4aee-8cc8-349e86681f8e/chunk-CEFPNUAV.mjs:13:49216)
    at po.hydrate (file:///home/runner/work/bellum-gens/bellum-gens/.angular/prerender-root/424d766a-8fe7-4aee-8cc8-349e86681f8e/chunk-7QFJOWNH.mjs:7:11676)
    at po.get (file:///home/runner/work/bellum-gens/bellum-gens/.angular/prerender-root/424d766a-8fe7-4aee-8cc8-349e86681f8e/chunk-7QFJOWNH.mjs:7:10785)
    at po.get (file:///home/runner/work/bellum-gens/bellum-gens/.angular/prerender-root/424d766a-8fe7-4aee-8cc8-349e86681f8e/chunk-7QFJOWNH.mjs:7:10870)
    at cu.get (file:///home/runner/work/bellum-gens/bellum-gens/.angular/prerender-root/424d766a-8fe7-4aee-8cc8-349e86681f8e/chunk-7QFJOWNH.mjs:7:21395)
    at Vg (file:///home/runner/work/bellum-gens/bellum-gens/.angular/prerender-root/424d766a-8fe7-4aee-8cc8-349e86681f8e/chunk-7QFJOWNH.mjs:7:23035)
    at Ug (file:///home/runner/work/bellum-gens/bellum-gens/.angular/prerender-root/424d766a-8fe7-4aee-8cc8-349e86681f8e/chunk-7QFJOWNH.mjs:7:23275)
    at U (file:///home/runner/work/bellum-gens/bellum-gens/.angular/prerender-root/424d766a-8fe7-4aee-8cc8-349e86681f8e/chunk-7QFJOWNH.mjs:7:47552)
An unhandled exception occurred: globalThis.getComputedStyle is not a function
  • igniteui-angular version: 18+
  • browser: server

Steps to reproduce

The issue, I believe, comes from the ThemeService, which calls getComputetStyle on the globalThis on init.

Result

Pre-rendering/SSR is unsuccessful.

Expected result

Pre-rendering/SSR should succeed.

Attachments

https://github.com/BellumGens/bellum-gens/actions/runs/10234144439/job/28313244985?pr=364

@damyanpetev
Copy link
Member

Weirdly enough, this error is also present in our test bundle app:
https://github.com/IgniteUI/igniteui-angular/actions/runs/10234317877/job/28313639498#step:16:11

However, it doesn't cause the entire build to fail, just the specific route emit. I've looked at the angular.json, server.ts and tsconfig.json setups and so far haven't landed on a significant different that caused the bundle-test to actually fail because of that error.
The fix would be easy enough, but I'd like to dig a bit more to see if I can get the CI to be report useful errors correctly.

@damyanpetev damyanpetev added 🛠️ status: in-development Issues and PRs with active development on them and removed 🆕 status: new labels Aug 5, 2024
@damyanpetev damyanpetev added ✅ status: resolved Applies to issues that have pending PRs resolving them, or PRs that have already merged. and removed 🛠️ status: in-development Issues and PRs with active development on them labels Aug 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Any issue that describes a bug 📉 regression 🔥 severity: high ✨ themes version: 18.0.x version: 18.1.x ✅ status: resolved Applies to issues that have pending PRs resolving them, or PRs that have already merged.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants