Skip to content

Instantly share code, notes, and snippets.

@larsw
Last active August 3, 2016 14:26
Show Gist options
  • Save larsw/10e2f0f9dfbbb5cc0bd328f6bb71f06d to your computer and use it in GitHub Desktop.
Save larsw/10e2f0f9dfbbb5cc0bd328f6bb71f06d to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<div id="main"></div>
<script src="vendor.js"></script>
<script src="bundle.js"></script>
</body>
</html>
var path = require('path');
var webpack = require('webpack');
var pkg = require('./package.json');
module.exports = {
entry: {
app: ['webpack-dev-server/client?http://localhost:8080',
'webpack/hot/only-dev-server',
'./src/index'],
vendor: Object.keys(pkg.dependencies)
},
output: {
path: path.join(__dirname, 'public'),
publicPath: '/',
filename: 'bundle.js'
},
module: {
loaders: [ {
test: /\.js$/,
include: [path.join(__dirname, 'src')],
loaders: ['react-hot', 'babel?cacheDirectory']
}]
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new webpack.optimize.CommonsChunkPlugin('vendor', 'vendor.js', Infinity),
new webpack.NoErrorsPlugin()
],
devServer: {
historyApiFallback: true,
contentBase: './public/'
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment