I'm having some problems using a data-grid module (fixed-data-table). I'm using the webpack distribution. I always see this error in pre-render:
TypeError: Object #
The Object in question is "global" which in most cases I'd assume would be window. I'm not sure what it ends up being within the react-rails pre-render. I'm guessing the pre-render environment doesn't provide these. Surely all JS environments should provide these methods?
Looks like ExecJS doesn't support setTimeout: https://github.com/rails/execjs#faq (Or therubyracer: https://github.com/cowboyd/therubyracer/issues/325)
I've gotten around this by adding this at the top of the generated webpack, but would like a better solution.
(function (global) {
global.clearTimeout = global.clearTimeout || function () {};
global.setTimeout = global.setTimeout || function () {};
}(this));
Essentially this means any methods passed to setTimeout will never be called, which should be fine for rendering purposes.
Glad you found a workaround!
@tbrd May I ask how you added that to the generated webpack? is there a way I can set in config to write that to the top of the compiled file? thanks.
@tbrd I cannot figure out where to define the function in webpack.
Most helpful comment
I've gotten around this by adding this at the top of the generated webpack, but would like a better solution.
(function (global) {
global.clearTimeout = global.clearTimeout || function () {};
global.setTimeout = global.setTimeout || function () {};
}(this));
Essentially this means any methods passed to setTimeout will never be called, which should be fine for rendering purposes.