'How do I use a proxy with Node and ESM?
In the olden days I had something like this...
const HttpsProxyAgent = require("https-proxy-agent");
new HttpsProxyAgent(URL)
However when I convert to ESM...
import HttpsProxyAgent from "https-proxy-agent";
// Also tried
// import * as HttpsProxyAgent from "https-proxy-agent";
new HttpsProxyAgent(URL)
I get...
(node:7856) UnhandledPromiseRejectionWarning: TypeError: HttpsProxyAgent is not a constructor
So how do I accomplish this now? Is there a native ES6 proxy that node supports?
Solution 1:[1]
This way works:
import { HttpsProxyAgent } from 'https-proxy-agent';
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | ut9081 |
