Skip to content

Instantly share code, notes, and snippets.

@xuyuji9000
Last active March 20, 2017 08:15
Show Gist options
  • Save xuyuji9000/7a8422b50a39d976f4e9797a51e3288d to your computer and use it in GitHub Desktop.
Save xuyuji9000/7a8422b50a39d976f4e9797a51e3288d to your computer and use it in GitHub Desktop.
react webpack with hotload
var path = require("path");
var webpack = require("webpack");
module.exports = {
entry: [
'webpack-dev-server/client?http://0.0.0.0:8080', // WebpackDevServer host and port
'webpack/hot/only-dev-server', // "only" prevents reload on syntax errors
"./src/app.js" // appʼs entry point
],
devtool: "source-map",
output: {
path: __dirname + "/dist",
filename: "bundle.js",
publicPath: "/assets/"
},
plugins: [
new webpack.HotModuleReplacementPlugin()
],
module: {
loaders: [{
test: /.jsx?$/,
exclude: /node_modules/,
loaders: ['react-hot-loader', 'babel-loader?'+JSON.stringify({
presets: ['es2015', 'react']
})]
}]
}
}
@xuyuji9000
Copy link
Author

This is a react dev webpack configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment