From 763224755647f0cda91282e119a2726118b383a2 Mon Sep 17 00:00:00 2001 From: Bjorn Lu Date: Sat, 18 Jun 2022 00:47:53 +0800 Subject: [PATCH] fix(server): skip localhost verbatim dns lookup (#8642) --- packages/vite/src/node/http.ts | 8 -------- 1 file changed, 8 deletions(-) diff --git a/packages/vite/src/node/http.ts b/packages/vite/src/node/http.ts index c2757f36477600..8710c274fd83d1 100644 --- a/packages/vite/src/node/http.ts +++ b/packages/vite/src/node/http.ts @@ -5,7 +5,6 @@ import type { OutgoingHttpHeaders as HttpServerHeaders } from 'http' import type { ServerOptions as HttpsServerOptions } from 'https' -import { promises as dns } from 'dns' import type { Connect } from 'types/connect' import { isObject } from './utils' import type { ProxyOptions } from './server/middlewares/proxy' @@ -187,13 +186,6 @@ export async function httpServerStart( ): Promise { let { port, strictPort, host, logger } = serverOptions - // This could be removed when Vite only supports Node 17+ because verbatim=true is default - // https://github.com/nodejs/node/pull/39987 - if (host === 'localhost') { - const addr = await dns.lookup('localhost', { verbatim: true }) - host = addr.address - } - return new Promise((resolve, reject) => { const onError = (e: Error & { code?: string }) => { if (e.code === 'EADDRINUSE') {