mirror of
https://github.com/zulip/zulip.git
synced 2025-11-02 13:03:29 +00:00
webpack: Disable host check for webpack-dev-server.
Webpack dev server by default does host checking for requests. so in dev enviorment if the the request came for zulipdev.com it would not send js files which caused dev envoirment to not work.
This commit is contained in:
committed by
Tim Abbott
parent
62fb139af7
commit
bc454bab88
@@ -25,13 +25,15 @@ def run():
|
||||
['--config', 'tools/webpack.config.ts', '-p'] +
|
||||
['--env', 'production'])
|
||||
|
||||
def run_watch(host, port, minify):
|
||||
# type: (str, str, bool) -> None
|
||||
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]
|
||||
if minify:
|
||||
webpack_args.append('--optimize-minimize')
|
||||
if disable_host_check:
|
||||
webpack_args.append('--disable-host-check')
|
||||
subprocess.Popen(webpack_args)
|
||||
|
||||
def run_test():
|
||||
@@ -72,11 +74,14 @@ parser.add_argument('--port',
|
||||
parser.add_argument('--minify',
|
||||
action='store_true', dest='minify', default=False,
|
||||
help='Minify and optimize the assets (for development)')
|
||||
parser.add_argument('--disable-host-check',
|
||||
action='store_true', dest='disable_host_check', default=None,
|
||||
help='Disable host check for webpack-dev-server')
|
||||
|
||||
args = parser.parse_args()
|
||||
if args.test:
|
||||
run_test()
|
||||
elif args.watch:
|
||||
run_watch(args.host, args.port, args.minify)
|
||||
run_watch(args.host, args.port, args.minify, args.disable_host_check)
|
||||
else:
|
||||
run()
|
||||
|
||||
Reference in New Issue
Block a user