Closed ADumaine closed 8 years ago
Thanks for creating an issue. From the README:
Note: As of
hapi-react-views
v4.x your project must register a transpiler such asbabel
ornode-jsx
. An alternative to this is to transpile ahead of time and save the result to file.
The error your're seeing is because untranspiled code is being parsed.
You'll need to register a transpiler at a top level of your app:
require('babel-core/register')({
presets: ['react', 'es2015']
});
I thought I had that implemented but I found it was not done correctly. Since I started with aqua which uses glue I was able to add it to the index.js composeOptions rather than trying to get it to work in the manifest (kept asking for attributes).
Here is how I implemented it within the preRegister options.
var Glue = require('glue');
var Manifest = require('./manifest');
var composeOptions = {
relativeTo: __dirname,
preRegister: function(server, next){
require('babel-core/register')({
presets: ['react', 'es2015']
});
next();
}
};
module.exports = Glue.compose.bind(Glue, Manifest.get('/'), composeOptions);
Pages are now rendering. Thanks!!
Oh cool, thanks for sharing that. :+1:
I am in the process of updating a project from react 13 to 14 and hapi 11 along with updating to all the latest node modules in the project (based on dependencies). I've been able to sort out all the issues but am stuck on this one as it says it is an internal error. It seems to point to issue with rendering views by hapi-react-views but there is not enough info in the debug for me to figure it out. It appears to be an issue with an unexpected token <: but the project uses babel loader on all the jsx files. I have tried using the useNodeJsx:false in the manifest and that had no effect.
Is there some sort of compatibility issue with hapi-react-views and vision?
Here is the debug output. Any insight is appreciated.