I have completed the React/Elixir "learnphoenix.io" tutorial and I am on the Routes and Views part. I have a compilation error
ERROR in ./app/index.js
Module build failed: SyntaxError: Unexpected token (6:22)
4 | import { default as Home } from "./components/Home"
5 | import { default as Settings } from "./components/Settings"
> 6 | const App = props => (<div>{props.children}</div>)
| ^
7 | ReactDOM.render(
8 | <Router history={hashHistory}>
9 | <Route path="/" component={App}>
@ multi main
webpack: bundle is now VALID.
I'm new to React so I don't understand very well.
EDIT1: There is the webpack.config.js :
var path = require('path')
var webpack = require('webpack')
module.exports = {
devtool: 'eval',
entry: [
'webpack-dev-server/client?http://localhost:3000',
'./app/index'
],
output: {
path: path.join(__dirname, 'dist'),
filename: 'bundle.js'
},
module: {
loaders: [
{
test: /\.js$/,
loader: 'babel',
exclude: /node_modules/,
query: {
presets: ['es2015', 'babel']
},
include: path.join(__dirname, 'app')
}
]
},
resolve: {
extensions: [ '', '.js' ]
}
}
app/index.js :
import React from "react"
import ReactDOM from "react-dom"
import { Router, Route, IndexRoute, hashHistory } from "react-router"
import { default as Home } from "./components/Home"
import { default as Settings } from "./components/Settings"
const App = props => (<div>{props.children}</div>)
ReactDom.render(
<Router history={hashHistory}>
<Route path="/" component={App}>
<IndexRoute component={Home}/>
<Route path="settings" component={Settings}/>
</Route>
</Router>,
document.getElementById("root")
)
app/Home/index.js :
import React from "react"
export class Home extends React.Component {
render() {
return (<div>Home component</div>)
}
}
export default Home
Module build failed: Error: Couldn't find preset "babel" relative to directory "/home/jeremy/Bureau/projets/phoenix-chat-frontend/app"