Unexpected token - React babel

Viewed 8460

I am new to the world react and I have a bug that will not let me progress. This is my webpack

module.exports = {
entry: [
'./src/index.js'
],
output: {
path: __dirname,
publicPath: '/',
filename: 'bundle.js'
},
module: {
 loaders: [{
  exclude: /node_modules/,
  loader: 'babel'
 }]
}
resolve: {
 extensions: ['', '.js', '.jsx']
},
devServer: {
 historyApiFallback: true,
 contentBase: './'
}
};

This is my code js

import React from 'react';
import ReactDOM from 'react-dom';

import SearchBar from './components/search_bar';

const API = '';

const App = () => {
 return (
     <div>
         <SearchBar />
     </div>
 );
}

ReactDOM.render(<App />, document.querySelector('.container'));

This is error https://gyazo.com/be83135be6f0e7b8ca0c2852536c792f

I tried this solution but it does not work babel-loader jsx SyntaxError: Unexpected token

This is a project https://github.com/jmrosdev/Practicas/tree/master/React/youtube-search

Bye and thanks!

3 Answers
Related