Closed 18601673727 closed 9 years ago
@zpao
Yeah, may I ask one question first? Directly put JSXTransformer.js
into v8 will work or not?
Because I'm trying to modify the ReactJS.php
file and Chrome says:
Unable to load the webpage because the server sent no data.
Here's the code what I changed:
...
$react[] = "var React = global.React";
// app's components
$transformer = file_get_contents('/Users/abc/php/public/js/react/JSXTransformer.js');
$react[] = $transformer;
$react[] = $appsrc;
$react[] = ';';
...
Thanks!
You can't just include JSXTransformer and have it work. You actually need to run JSXTransformer (or preferably Babel) server side to transform the JSX to plain JS so that it's actually executable. $appsrc
needs to be turned from JSX to JS, which means another v8 context that needs to run. React-rails does this so you might be able to find some inspiration there.
You're right, the only way I could use for transpilation is node now, through it adds complexity to my project's architecture. Anyway I just found JSXTransformer is deprecated so this issue shall been closed and thanks very much for your time!
Feel free to have a go at it. This isn't an actively supported project so we won't be adding that ourselves.