Skip to content

Angular ssr/prerender is broken with 18 #14612

@kdinev

Description

@kdinev

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

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions