Skip to content

Commit

Permalink
refactor: lazy import https-proxy-agent
Browse files Browse the repository at this point in the history
also fixes with default export
  • Loading branch information
pi0 committed Oct 4, 2023
1 parent adc0ced commit 8372e55
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/_utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { promisify } from "node:util";
import type { Agent } from "node:http";
import { relative, resolve } from "pathe";
import { fetch } from "node-fetch-native";
import { HttpsProxyAgent } from "https-proxy-agent";
import type { GitInfo } from "./types";

export async function download(
Expand Down Expand Up @@ -81,6 +80,7 @@ export async function sendFetch(
process.env.HTTP_PROXY ||
process.env.http_proxy;
if (proxyEnv) {
const HttpsProxyAgent = await import("https-proxy-agent").then(r => r.HttpsProxyAgent || r.default);
options.agent = new HttpsProxyAgent(proxyEnv);
}
}
Expand Down

0 comments on commit 8372e55

Please sign in to comment.