reactjs / react-php-v8js

PHP library that renders React components on the server
Other
1.33k stars 127 forks source link

setTimeout is not defined #29

Closed rajivseelam closed 6 years ago

rajivseelam commented 8 years ago

Hi,

I keep getting this error:

V8Js::compileString():78458: ReferenceError: setTimeout is not defined

I am not sure where to start to solve this issue.

jurgenzz commented 8 years ago

I had the same issue, resolved it by adding this on top of my build:


if (!global.setTimeout) {
    global.setTimeout = null;
}
jordmccord commented 8 years ago

I'm having the same issue tried adding the "global.setTimeout = null;" and it is now saying "null is not a function!"

jurgenzz commented 8 years ago

Try making it as a function?

if (!global.setTimeout) {
    global.setTimeout = function() {};
}
rajivseelam commented 8 years ago

@jurgenzz

Where should we add this? Please let us know. Any file for example, very new to JS.

jurgenzz commented 8 years ago

Either on to of your entry file, if you are doing a build or just on top of the component file you are targeting with react-php

zpao commented 6 years ago

Your JS is being loaded directly into V8, so you don't have things that aren't part of ECMAScript (Eg anything that is defined on window in the browser context or other globals that node might set up)