Closed dotstormz closed 8 years ago
Error is as follows:
V8Js::compileString():19434: ReferenceError: module is not defined
PHP Test file is as follows:
include('../vendor/autoload.php'); $reactSource = file_get_contents('../node_modules/react/dist/react.js'); $appSource = file_get_contents('../app/Resources/js/components/Test.js'); $rjs = new \ReactJS($reactSource, $appSource); $rjs->setComponent('Test', []); echo '<div id="here">' . $rjs->getMarkup() . '</div>';
Javascript Component is as follows:
const Test = React.createClass({ render: function() { return React.createElement('div', {}, 'Hello, World') } }) module.exports = Test;
Are you able to shed any light as to why module is not available here? Thanks for your time.
You aren't in a CommonJS environment so module isn't defined. You should be able to leave off that entire line since Test will be a global in the context.
module
Test
Error is as follows:
PHP Test file is as follows:
Javascript Component is as follows:
Are you able to shed any light as to why module is not available here? Thanks for your time.