From b3c5965d392681f44c152f13a28f85a7e28bf2f4 Mon Sep 17 00:00:00 2001 From: cenfun Date: Fri, 22 Mar 2024 16:10:39 +0800 Subject: [PATCH] fixed ECONNREFUSED on NodeJS 18 --- CHANGELOG.md | 1 + lib/utils/request.js | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 123f9fed..27378af4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ - fixed CLI arguments for `--` separator - fixed sourcemap if range in a comment - added cache for sourcemap conversion + - fixed ECONNREFUSED on NodeJS 18 * 2.7.5 - fixed special generated codes for original coverage diff --git a/lib/utils/request.js b/lib/utils/request.js index abd9a8b9..82360516 100644 --- a/lib/utils/request.js +++ b/lib/utils/request.js @@ -1,5 +1,9 @@ const http = require('http'); const https = require('https'); +const dns = require('dns'); + +// fixed ECONNREFUSED on NodeJS 18 +dns.setDefaultResultOrder('ipv4first'); // minimal http request for get sourcemap json // https://nodejs.org/docs/latest/api/http.html#httprequesturl-options-callback