Skip to content

Commit 4a656b7

Browse files
committed
Merge pull request #114 from liseki/server-side-rendering-fix
Fix server-side rendering
2 parents 07808d9 + 217631b commit 4a656b7

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/utils/getPrefix.es6

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
export default (function() {
2-
if (typeof window === 'undefined') return '';
2+
// Checking specifically for 'window.document' is for pseudo-browser server-side
3+
// environments that define 'window' as the global context.
4+
// E.g. React-rails (see https://github.com/reactjs/react-rails/pull/84)
5+
if (typeof window === 'undefined' || typeof window.document === 'undefined') return '';
6+
37
// Thanks David Walsh
48
let styles = window.getComputedStyle(document.documentElement, ''),
59
pre = (Array.prototype.slice

0 commit comments

Comments
 (0)