diff --git a/packages/create-emotion/src/index.js b/packages/create-emotion/src/index.js index 587d1d516..3c4230706 100644 --- a/packages/create-emotion/src/index.js +++ b/packages/create-emotion/src/index.js @@ -312,7 +312,7 @@ function createEmotion( caches.registered = {} } - if (typeof window !== 'undefined') { + if (isBrowser) { let chunks = Array.from(document.querySelectorAll(`[data-emotion-${key}]`)) chunks.forEach(node => { // $FlowFixMe diff --git a/packages/create-emotion/src/utils.js b/packages/create-emotion/src/utils.js index 313f7db61..a9b46a2f3 100644 --- a/packages/create-emotion/src/utils.js +++ b/packages/create-emotion/src/utils.js @@ -71,7 +71,7 @@ export const classnames = (args: Array): string => { return cls } -export const isBrowser = typeof window !== 'undefined' +export const isBrowser = typeof document !== 'undefined' export type PrefixOption = | boolean