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.
This commit is contained in:
Pweaver (Paul Weaver)
2017-07-16 15:14:03 -04:00
committed by Tim Abbott
parent 0718eb5220
commit d3ffc81726
6 changed files with 63 additions and 16 deletions

View File

@@ -187,6 +187,10 @@ else:
webpack_cmd = ['./tools/webpack', '--watch', '--port', str(webpack_port)]
if options.minify:
webpack_cmd.append('--minify')
if options.interface:
webpack_cmd += ["--host", options.interface]
else:
webpack_cmd += ["--host", "0.0.0.0"]
cmds.append(webpack_cmd)
for cmd in cmds:
subprocess.Popen(cmd)
@@ -380,7 +384,6 @@ class Application(web.Application):
(r"/json/events.*", TornadoHandler),
(r"/api/v1/events.*", TornadoHandler),
(r"/webpack.*", WebPackHandler),
(r"/sockjs-node.*", WebPackHandler),
(r"/sockjs.*", TornadoHandler),
(r"/.*", DjangoHandler)
]