boron icon indicating copy to clipboard operation
boron copied to clipboard

Server Side Rendering

Open catamphetamine opened this issue 10 years ago • 4 comments

ReferenceError: window is not defined
    at module.exports (G:\work\cinema\node_modules\boron\node_modules\react-kit\getVendorPrefix.js:9:18)

no window on the server use something instead (maybe this, maybe global)

catamphetamine avatar Jul 31 '15 16:07 catamphetamine

Indeed, one possible workaround is:

var canUseDOM = require('react/lib/ExecutionEnvironment').canUseDOM;
if (canUseDOM) {
  var insertKeyframesRule = require('react-kit/insertKeyframesRule');
  var appendVendorPrefix = require('react-kit/appendVendorPrefix');
} else {
  var insertKeyframesRule = function() {};
  var appendVendorPrefix = function() {};
}

g-p-g avatar Aug 13 '15 23:08 g-p-g

when using boron, I got this error: 'ReferenceError: document is not defined'

the1sky avatar Jan 21 '16 04:01 the1sky

Just use react-modal everybody

On Thursday, January 21, 2016, the1sky [email protected] wrote:

when using boron, I got this error: 'ReferenceError: document is not defined'

— Reply to this email directly or view it on GitHub https://github.com/yuanyan/boron/issues/8#issuecomment-173450726.

catamphetamine avatar Jan 21 '16 09:01 catamphetamine

but it is not as pretty... :) @g-p-g - did you mean this code to be changed in the boron internal component or did you mean to use this code in the application that uses it? What are the chances of this bug being fixed? All react components need to support isomorphic apps... thus be able to be rendered on the server. What gives?

YarivGilad avatar Apr 03 '16 10:04 YarivGilad