Having a bit of trouble with my react/webpack set up, the first bit of JSX it hits, I "Unexpected Token" - as in the first < in the JSX . Here is my Webpack config :
const path = require('path');
const webpack = require('webpack');
module.exports = {
entry: [
'webpack-dev-server/client?http://localhost:8080',
'webpack/hot/only-dev-server',
'./app/index.jsx'
],
module: {
loaders: [{
test: /\.jsx?$/,
exclude: /node_modules/,
loader: 'babel-loader'
}]
},
resolve: {
extensions: ['', '.js', '.jsx']
},
output: {
path: path.join(__dirname, 'dist'),
publicPath: '/',
filename: 'bundle.js'
},
devServer: {
contentBase: './dist',
hot: true
},
plugins: [
new webpack.HotModuleReplacementPlugin()
]
};
I noticed if i swap the loaders to use react-hot, it no longer knows how to read the es6 imports :
module: {
loaders: [{
test: /\.jsx?$/,
exclude: /node_modules/,
include: path.join(__dirname, 'src'),
loader: 'react-hot!babel'
}]
},
(gives the error - Unexpected token You may need an appropriate loader to handle this file type. Referencing the import lines )
Unsure what I am missing here, could use a some help. Thanks!