Skip to content

Instantly share code, notes, and snippets.

@neroze
Last active June 21, 2017 05:29
Show Gist options
  • Save neroze/9a56f1e53bef38ba41bb1eb5fc404265 to your computer and use it in GitHub Desktop.
Save neroze/9a56f1e53bef38ba41bb1eb5fc404265 to your computer and use it in GitHub Desktop.
Web pack setting with hot reload
// you need node server running with webpack middle ware
// simple server with webpack middle ware can be found here
// https://gist.github.com/neroze/083bb4355cffbb593696178c3adef256
// Basic package.json for reactjs Development kick start
// https://gist.github.com/neroze/63c77d9e62226b60f61371df4abada6d
var webpack = require('webpack');
var path = require('path');
var WebpackBuildNotifierPlugin = require('webpack-build-notifier');
var BUILD_DIR = path.resolve(__dirname, 'src/client/public/');
var APP_DIR = path.resolve(__dirname, 'src/client/app');
var config = {
entry: [
'webpack-dev-server/client?http://localhost:5050',
'webpack/hot/dev-server',
APP_DIR + '/index.js'
],
output: {
path: BUILD_DIR,
filename: 'bundle.js',
publicPath: '/src/client/public'
},
resolve: {
extensions: ['', '.js']
},
module : {
loaders : [
{
test : /\.jsx?/,
include : APP_DIR,
loader : 'babel'
}
]
},
devtool: 'eval-source-map',
plugins: [
new webpack.HotModuleReplacementPlugin(),
new webpack.NoErrorsPlugin(),
new WebpackBuildNotifierPlugin({
title: "My Project Webpack Build",
// logo: path.resolve("./img/favicon.png"),
suppressSuccess: true
})
]
};
module.exports = config;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment