From 384f1af06730078764d4c501a3982f3785f93911 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Tue, 10 Feb 2026 11:39:01 +0100 Subject: [PATCH] Add `--host` option `npx gulp server` Using `0.0.0.0` instead of `localhost` allows connecting from other devices, significantly simplifying testing on mobile devices. This is controlled by the `--host` CLI flag and not enabled by default, since allowing external connections comes with security implications (e.g. when on a public network without a properly configured firewall). There might be reasons to want to listen on custom hostnames, but as the most common usage will probably be `--host 0.0.0.0`, there is a shorter alias `--host 0` for it. --- gulpfile.mjs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/gulpfile.mjs b/gulpfile.mjs index 4f790b8ef..9f0938a68 100644 --- a/gulpfile.mjs +++ b/gulpfile.mjs @@ -2210,8 +2210,17 @@ gulp.task( } } + let host; + const j = process.argv.indexOf("--host"); + if (j >= 0 && j + 1 < process.argv.length) { + host = process.argv[j + 1]; + if (host === "0") { + host = "0.0.0.0"; + } + } + const { WebServer } = await import("./test/webserver.mjs"); - const server = new WebServer({ port }); + const server = new WebServer({ host, port }); server.start(); } )