Skip to content

Instantly share code, notes, and snippets.

@schatterjee4
Forked from bcbroom/webpack.config.js
Created January 6, 2018 15:46
Show Gist options
  • Save schatterjee4/7dada4a13baab3e3419bfbb95e8b370a to your computer and use it in GitHub Desktop.
Save schatterjee4/7dada4a13baab3e3419bfbb95e8b370a to your computer and use it in GitHub Desktop.
const { resolve } = require('path');
const webpack = require('webpack')
module.exports = {
entry: [
//'react-hot-loader/patch',
// activate HMR for React
'webpack-dev-server/client?http://localhost:8080',
// bundle the client for webpack-dev-server
// and connect to the provided endpoint
'webpack/hot/only-dev-server',
// bundle the client for hot reloading
// only- means to only hot reload for successful updates
'./index.js'
// the entry point of our app
],
output: {
filename: 'bundle.js',
path: resolve(__dirname, 'dist'),
publicPath: '/'
// necessary for HMR to know where to load the hot update chunks
},
context: resolve(__dirname, 'src'),
devServer: {
hot: true,
contentBase: resolve(__dirname, 'dist'),
publicPath: '/'
},
module: {
rules: [
{
test: /\.js?$/,
use: [
'react-hot-loader',
'babel-loader',
],
exclude: /node_modules/
},
],
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
],
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment