From b3efa609292e5b9cb968a38e99cea9b2279911fd Mon Sep 17 00:00:00 2001 From: Sebastian Beltran Date: Mon, 12 Jan 2026 17:33:50 +0000 Subject: [PATCH 1/3] feat: add findIp example and remove internalIPSync example --- .../api/{internal-ip => find-ip}/README.md | 8 +++---- examples/api/{internal-ip => find-ip}/app.js | 4 ++-- examples/api/internal-ip-sync/README.md | 23 ------------------- examples/api/internal-ip-sync/app.js | 9 -------- 4 files changed, 6 insertions(+), 38 deletions(-) rename examples/api/{internal-ip => find-ip}/README.md (65%) rename examples/api/{internal-ip => find-ip}/app.js (65%) delete mode 100644 examples/api/internal-ip-sync/README.md delete mode 100644 examples/api/internal-ip-sync/app.js diff --git a/examples/api/internal-ip/README.md b/examples/api/find-ip/README.md similarity index 65% rename from examples/api/internal-ip/README.md rename to examples/api/find-ip/README.md index 07c1446444..00e67e7da6 100644 --- a/examples/api/internal-ip/README.md +++ b/examples/api/find-ip/README.md @@ -1,13 +1,13 @@ -# internalIP(family: "v4" | "v6") +# findIp(family: "v4" | "v6") -Returns the internal IP address asynchronously. +Returns the internal IP address. ```js const WebpackDevServer = require("webpack-dev-server"); const logInternalIPs = async () => { - const localIPv4 = await WebpackDevServer.internalIP("v4"); - const localIPv6 = await WebpackDevServer.internalIP("v6"); + const localIPv4 = WebpackDevServer.findIp("v4", false); + const localIPv6 = WebpackDevServer.findIp("v6", false); console.log("Local IPv4 address:", localIPv4); console.log("Local IPv6 address:", localIPv6); diff --git a/examples/api/internal-ip/app.js b/examples/api/find-ip/app.js similarity index 65% rename from examples/api/internal-ip/app.js rename to examples/api/find-ip/app.js index 5b95533e56..b4dc418ddc 100644 --- a/examples/api/internal-ip/app.js +++ b/examples/api/find-ip/app.js @@ -3,8 +3,8 @@ const WebpackDevServer = require("../../../lib/Server"); const logInternalIPs = async () => { - const localIPv4 = await WebpackDevServer.internalIP("v4"); - const localIPv6 = await WebpackDevServer.internalIP("v6"); + const localIPv4 = WebpackDevServer.findIp("v4", false); + const localIPv6 = WebpackDevServer.findIp("v6", false); console.log("Local IPv4 address:", localIPv4); console.log("Local IPv6 address:", localIPv6); diff --git a/examples/api/internal-ip-sync/README.md b/examples/api/internal-ip-sync/README.md deleted file mode 100644 index 6c880a4e7d..0000000000 --- a/examples/api/internal-ip-sync/README.md +++ /dev/null @@ -1,23 +0,0 @@ -# internalIPSync(family: "v4" | "v6") - -Returns the internal IP address synchronously. - -```js -const WebpackDevServer = require("webpack-dev-server"); - -const localIPv4 = WebpackDevServer.internalIPSync("v4"); -const localIPv6 = WebpackDevServer.internalIPSync("v6"); - -console.log("Local IPv4 address:", localIPv4); -console.log("Local IPv6 address:", localIPv6); -``` - -Use the following command to run this example: - -```console -node app.js -``` - -## What Should Happen - -- The script should log your local IPv4 and IPv6 address. diff --git a/examples/api/internal-ip-sync/app.js b/examples/api/internal-ip-sync/app.js deleted file mode 100644 index ecf504551c..0000000000 --- a/examples/api/internal-ip-sync/app.js +++ /dev/null @@ -1,9 +0,0 @@ -"use strict"; - -const WebpackDevServer = require("../../../lib/Server"); - -const localIPv4 = WebpackDevServer.internalIPSync("v4"); -const localIPv6 = WebpackDevServer.internalIPSync("v6"); - -console.log("Local IPv4 address:", localIPv4); -console.log("Local IPv6 address:", localIPv6); From 1973589e94c9e6d5b5000d302abc8116eaaa664b Mon Sep 17 00:00:00 2001 From: Sebastian Beltran Date: Mon, 12 Jan 2026 17:49:56 +0000 Subject: [PATCH 2/3] feat: remove internalIP methods and update references to findIp --- lib/Server.js | 18 ------------------ test/e2e/allowed-hosts.test.js | 2 +- test/e2e/web-socket-server-url.test.js | 12 ++++++------ test/server/open-option.test.js | 2 +- types/lib/Server.d.ts | 10 ---------- 5 files changed, 8 insertions(+), 36 deletions(-) diff --git a/lib/Server.js b/lib/Server.js index 87c4edb347..ad990ab1f6 100644 --- a/lib/Server.js +++ b/lib/Server.js @@ -475,24 +475,6 @@ class Server { } } - // TODO remove me in the next major release, we have `findIp` - /** - * @param {"v4" | "v6"} family family - * @returns {Promise} internal API - */ - static async internalIP(family) { - return Server.findIp(family, false); - } - - // TODO remove me in the next major release, we have `findIp` - /** - * @param {"v4" | "v6"} family family - * @returns {string | undefined} internal IP - */ - static internalIPSync(family) { - return Server.findIp(family, false); - } - /** * @param {Host} hostname hostname * @returns {Promise} resolved hostname diff --git a/test/e2e/allowed-hosts.test.js b/test/e2e/allowed-hosts.test.js index 163a24f265..f31769baea 100644 --- a/test/e2e/allowed-hosts.test.js +++ b/test/e2e/allowed-hosts.test.js @@ -1657,7 +1657,7 @@ describe("allowed hosts", () => { }); it("should always allow value from the `host` options if options.allowedHosts is auto", async () => { - const networkIP = Server.internalIPSync("v4"); + const networkIP = Server.findIp("v4", false); const options = { host: networkIP, allowedHosts: "auto", diff --git a/test/e2e/web-socket-server-url.test.js b/test/e2e/web-socket-server-url.test.js index 24147d0ba2..e6ed541468 100644 --- a/test/e2e/web-socket-server-url.test.js +++ b/test/e2e/web-socket-server-url.test.js @@ -113,7 +113,7 @@ describe("web socket server URL", () => { it(`should work behind proxy, when hostnames are different and ports are same ("${webSocketServer}")`, async () => { const devServerHost = "127.0.0.1"; const devServerPort = port1; - const proxyHost = Server.internalIPSync("v4"); + const proxyHost = Server.findIp("v4", false); const proxyPort = port1; const compiler = webpack(config); @@ -209,7 +209,7 @@ describe("web socket server URL", () => { it(`should work behind proxy, when hostnames are different and ports are different ("${webSocketServer}")`, async () => { const devServerHost = "localhost"; const devServerPort = port1; - const proxyHost = Server.internalIPSync("v4"); + const proxyHost = Server.findIp("v4", false); const proxyPort = port2; const compiler = webpack(config); @@ -310,7 +310,7 @@ describe("web socket server URL", () => { it(`should work behind proxy, when the "host" option is "local-ip" and the "port" option is "auto" ("${webSocketServer}")`, async () => { process.env.WEBPACK_DEV_SERVER_BASE_PORT = 40000; - const proxyHost = Server.internalIPSync("v4"); + const proxyHost = Server.findIp("v4", false); const proxyPort = port2; const compiler = webpack(config); @@ -2006,7 +2006,7 @@ describe("web socket server URL", () => { }); it(`should work when "host" option is IPv4 ("${webSocketServer}")`, async () => { - const hostname = Server.internalIPSync("v4"); + const hostname = Server.findIp("v4", false); const compiler = webpack(config); const devServerOptions = { webSocketServer, @@ -2074,7 +2074,7 @@ describe("web socket server URL", () => { }); it(`should work when "host" option is "local-ip" ("${webSocketServer}")`, async () => { - const hostname = Server.internalIPSync("v4"); + const hostname = Server.findIp("v4", false); const compiler = webpack(config); const devServerOptions = { webSocketServer, @@ -2143,7 +2143,7 @@ describe("web socket server URL", () => { }); it(`should work when "host" option is "local-ipv4" ("${webSocketServer}")`, async () => { - const hostname = Server.internalIPSync("v4"); + const hostname = Server.findIp("v4", false); const compiler = webpack(config); const devServerOptions = { webSocketServer, diff --git a/test/server/open-option.test.js b/test/server/open-option.test.js index fea4bf65a6..11e249d4ba 100644 --- a/test/server/open-option.test.js +++ b/test/server/open-option.test.js @@ -5,7 +5,7 @@ const Server = require("../../lib/Server"); const config = require("../fixtures/simple-config/webpack.config"); const port = require("../ports-map")["open-option"]; -const internalIPv4 = Server.internalIPSync("v4"); +const internalIPv4 = Server.findIp("v4", false); let open; diff --git a/types/lib/Server.d.ts b/types/lib/Server.d.ts index 47dfba4c62..c46b9ea61a 100644 --- a/types/lib/Server.d.ts +++ b/types/lib/Server.d.ts @@ -1141,16 +1141,6 @@ declare class Server< gatewayOrFamily: string, isInternal?: boolean | undefined, ): string | undefined; - /** - * @param {"v4" | "v6"} family family - * @returns {Promise} internal API - */ - static internalIP(family: "v4" | "v6"): Promise; - /** - * @param {"v4" | "v6"} family family - * @returns {string | undefined} internal IP - */ - static internalIPSync(family: "v4" | "v6"): string | undefined; /** * @param {Host} hostname hostname * @returns {Promise} resolved hostname From c830713b70a12689506ea06d1bc84625e3e0879a Mon Sep 17 00:00:00 2001 From: Sebastian Beltran Date: Mon, 12 Jan 2026 17:53:46 +0000 Subject: [PATCH 3/3] docs: add migration guide for webpack-dev-server@6.0.0 --- migration-v6.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 migration-v6.md diff --git a/migration-v6.md b/migration-v6.md new file mode 100644 index 0000000000..2a44ec147a --- /dev/null +++ b/migration-v6.md @@ -0,0 +1,19 @@ +# Migration guide + +This document serves as a migration guide for `webpack-dev-server@6.0.0`. + +## Deprecations + +- The static methods `internalIP` and `internalIPSync` were removed. Use `findIp` instead. + + v4: + + ```js + const ip = Server.internalIP("v4"); + ``` + + v5: + + ```js + const ip = Server.findIp("v4", true); + ```