mirror of https://github.com/zulip/zulip.git
webpack: Fix Hot Module Reloading in webpack.
This commit fixes hot module replacement in webpack. To do this we open port 9994 used by webpack to communicate between browser and devserver. The attempts to forward the proxy from 9991 failed so the last resort was to open up the webpack port. It also removes an uncessary plugin in the webpack config and moves the --hot flag to tools/webpack.
This commit is contained in:
parent
bda9f3e3ea
commit
f20671a509
|
@ -121,6 +121,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
|||
end
|
||||
|
||||
config.vm.network "forwarded_port", guest: 9991, host: host_port, host_ip: host_ip_addr
|
||||
config.vm.network "forwarded_port", guest: 9994, host: host_port + 3, host_ip: host_ip_addr
|
||||
# Specify LXC provider before VirtualBox provider so it's preferred.
|
||||
config.vm.provider "lxc" do |lxc|
|
||||
if command? "lxc-ls"
|
||||
|
|
|
@ -29,7 +29,16 @@ def run_watch(host, port, minify, disable_host_check):
|
|||
# type: (str, str, bool, bool) -> None
|
||||
"""watches and rebuilds on changes, serving files from memory via webpack-dev-server"""
|
||||
webpack_args = ['node', 'node_modules/.bin/webpack-dev-server']
|
||||
webpack_args += ['--config', 'tools/webpack.config.ts', '--port', port, "--host", host]
|
||||
webpack_args += [
|
||||
'--config',
|
||||
'tools/webpack.config.ts',
|
||||
'--host', host,
|
||||
'--port', port,
|
||||
# We add the hot flag using the cli because it takes care
|
||||
# of addition to entry points and adding the plugin
|
||||
# automatically
|
||||
'--hot'
|
||||
]
|
||||
if minify:
|
||||
webpack_args.append('--optimize-minimize')
|
||||
if disable_host_check:
|
||||
|
|
|
@ -91,21 +91,16 @@ export default (env?: string) : webpack.Configuration => {
|
|||
new BundleTracker({filename: 'var/webpack-stats-dev.json'}),
|
||||
// Better logging from console for hot reload
|
||||
new webpack.NamedModulesPlugin(),
|
||||
// Hot Reload of code in development
|
||||
new webpack.HotModuleReplacementPlugin(),
|
||||
// script-loader should load sourceURL in dev
|
||||
new webpack.LoaderOptionsPlugin({debug: true}),
|
||||
];
|
||||
|
||||
config.devServer = {
|
||||
clientLogLevel: "warning",
|
||||
hot: true,
|
||||
inline: false,
|
||||
stats: "minimal",
|
||||
clientLogLevel: "error",
|
||||
stats: "errors-only",
|
||||
watchOptions: {
|
||||
aggregateTimeout: 100,
|
||||
poll: 100,
|
||||
},
|
||||
poll: 100
|
||||
}
|
||||
};
|
||||
}
|
||||
return config;
|
||||
|
|
Loading…
Reference in New Issue