zulip/tools/webpack.dev.config.js
Pweaver (Paul Weaver) d3ffc81726 Enable Hot Module Replacement in webpack.
This allow the webbpack dev server to properly reload JavaScript modules
while running in dev without restarting the server. We need to connect
to webpack-dev-server directly because SockJS doesn't support more than
one connection on the same host/port.
2017-07-18 11:02:05 -07:00

34 lines
1.0 KiB
JavaScript

var config = require('./webpack.config.js');
var BundleTracker = require('webpack-bundle-tracker');
var webpack = require('webpack');
// Built webpack dev asset reloader
config.entry.common.unshift('webpack/hot/dev-server');
// Use 0.0.0.0 so that we can set a port but still use the host
// the browser is connected to.
config.entry.common.unshift('webpack-dev-server/client?http://0.0.0.0:9994');
// Out JS debugging tools
config.entry.common.push('./static/js/debug.js');
config.devtool = 'eval';
config.output.publicPath = '/webpack/';
config.plugins.push(new BundleTracker({filename: 'static/webpack-bundles/webpack-stats-dev.json'}));
// Hot Reload of code in development
config.plugins.push(new webpack.HotModuleReplacementPlugin());
// Better logging from console for hot reload
config.plugins.push(new webpack.NamedModulesPlugin());
config.devServer = {
clientLogLevel: "warning",
hot: true,
inline: false,
stats: "errors-only",
watchOptions: {
aggregateTimeout: 300,
poll: 1000,
},
};
module.exports = config;