Skip to content

Commit 318d15f

Browse files
author
Benjamin Kniffler
authored
Update index.ts
1 parent 21bc9f8 commit 318d15f

File tree

1 file changed

+3
-0
lines changed
  • libraries/load-themed-styles/src

1 file changed

+3
-0
lines changed

libraries/load-themed-styles/src/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,9 @@ function initializeThemeState(): IThemeState {
164164
* @param {boolean} loadAsync When true, always load styles in async mode, irrespective of current sync mode.
165165
*/
166166
export function loadStyles(styles: string | ThemableArray, loadAsync: boolean = false): void {
167+
if (typeof document === 'undefined') {
168+
return;
169+
}
167170
measure(() => {
168171
const styleParts: ThemableArray = Array.isArray(styles) ? styles : splitStyles(styles);
169172
if (_injectStylesWithCssText === undefined) {

0 commit comments

Comments
 (0)