Webpack unexpected token in JS file
<p>I'm learning react and flux, and in lesson 1 the tutorial has failed me.</p>

<p><a href="https://egghead.io/lessons/react-flux-architecture-overview-and-project-setup?play=yes#/tab-discuss" rel="nofollow noreferrer">This tutorial</a> immediately breaks on 'npm start' with the following errors:</p>

<pre><code>ERROR in ./src/js/main.js
Module parse failed: /Users/me/Projects/egghead-flux/src/js/main.js Unexpected token (4:16)
You may need an appropriate loader to handle this file type.
SyntaxError: Unexpected token (4:16)
at Parser.pp$4.raise (/Users/me/Projects/egghead-flux/node_modules/acorn/dist/acorn.js:2221:15)
</code></pre>

<p>It doesn't seem to understand <code>ReactDOM.render(&lt;App /&gt;, document.getElementById('main'));</code> I assume parsing the JSX <code>&lt;App /&gt;</code> part is failing.</p>

<p>Has anyone encountered this issue before? Removing / reinstalling node modules does nothing. Is there some setup step missing from the video?</p>

<p>Main.js</p>

<pre><code>import React from 'react';
import ReactDOM from 'react-dom';
import App from './components/app';
ReactDOM.render(&lt;App /&gt;, document.getElementById('main'));
</code></pre>

<p>App.js</p>

<pre><code>import React from 'react';
    export default class App extends React.Component {
        render(){
            return &lt;h1&gt;Flux&lt;/h1&gt;
        }
    }
</code></pre>

<p>webpack.config.js</p>

<pre><code>module.exports = {
    entry: './src/js/main.js',
    output:{
        path:'./dist',
        filename: 'bundle.js',
        publicPath: '/'
    },
    devServer: {
        inline: true,
        contentBase: './dist'
    },
    module: {
        loaders: [
            {
                test: '/\.jsx?$/',
                exclude: /(node_modules|bower_components)/,
                loader: 'babel',
                query:{
                    presets: ['es2015', 'react']
                }
            }
        ]
    }
}
</code></pre>

<p>package.json</p>

<pre><code>{
  "name": "egghead-flux",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "start": "webpack-dev-server"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "flux": "^3.1.0",
    "react": "^15.3.2",
    "react-dom": "^15.3.2",
    "react-router": "^3.0.0"
  },
  "devDependencies": {
    "babel": "^6.5.2",
    "babel-loader": "^6.2.7",
    "babel-preset-es2015": "^6.18.0",
    "babel-preset-react": "^6.16.0",
    "webpack": "^1.13.3",
    "webpack-dev-server": "^1.16.2"
  }
}
</code></pre>