Closed sandrodz closed 8 years ago
The return value of render function should have at least one element.
So either
var Entry = React.createClass({
render: function() {
return (<div />);
}
});
or
var Entry = React.createClass({
render: function() {
return null;
}
});
Hi, thanks for looking into this :) I've tried with html elements, error remains the same.
4 | render: function() {
5 |
> 6 | return (<p>Entry</p>);
| ^
7 | }
8 | });
9 |
It seems there is some kind of issue with babel? I'm not familiar to say for sure. But I saw this: http://stackoverflow.com/questions/33460420/babel-loader-jsx-syntaxerror-unexpected-token
at the moment I've switched to this: https://github.com/richardstevens/metalsmith-react-tpl it uses babel < 6 and works perfectly fine.
I'd rather use your version though, @richardstevens seems to have cloned your repo without license or attribution. not cool.
@sandrodz Ah. yes. I've managed to reproduce the error. Babel 6 changed the way they actually process files. Out of the box, it doesn't do anything now and needs plugins to actually transform the files. You'll need to have
npm install babel-preset-es2015
npm install babel-preset-react
and add a .babelrc
file with the following set
{
"presets": ["es2015", "react"]
}
For more information: https://babeljs.io/docs/plugins/#presets
Thanks. I'm aware of the re-upload and am keeping a lookout on it. There isn't much I can do about it at the moment though.. Sigh...
nice! it worked :) :+1:
Thanks!
I'm probably doing something wrong. getting unexpected token error:
deps:
build.js
entry.jsx