example/src/webpack.config.js
import HtmlWebpackPlugin from 'html-webpack-plugin'
import webpack from 'webpack'
import path from 'path'
const confg = {
devtool: 'source-map',
entry: [
'webpack-dev-server/client?http://localhost:3000',
'webpack/hot/dev-server',
path.resolve('src','index.js')
],
output: {
path: path.resolve('public'),
filename: 'application.js',
publicPath: '/'
},
plugins: [
new HtmlWebpackPlugin({
template: path.resolve('src', 'index.html')
}),
new webpack.HotModuleReplacementPlugin()
],
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel-loader',
options: {
cacheDirectory: true,
plugins: ['react-hot-loader/babel'],
presets: ['es2015', 'react', 'stage-0']
}
}
]
},
mode: 'development',
resolve: {
modules: [
'node_modules',
path.resolve('node_modules')
]
}
}
export default confg