You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Force axios to use the http adapter instead of xhr #5263
Is your feature request related to a problem? Please describe.
I am creating a library that will mostly be used in electron projects. The library needs to perform http request to a localhost server that uses a self signed certificate, so I need to use https.Agent. The problem is, that axios uses the xhr adapter instead of the http adapter. When i try to import the correct adapter from axios/lib/adapters/http I get the error ERR_PACKAGE_PATH_NOT_EXPORTED.
Describe the solution you'd like
I need a way to tell axios to always use the http adapter. The easiest way to do this is by exposing axios/lib/adapters/http.
Uncaught Exception:
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './lib/adapters/http' is not defined by "exports" in /home/willian/projets/electron-quick-start/node_modules/axios/package.json
at new NodeError (node:internal/errors:372:5)
at throwExportsNotFound (node:internal/modules/esm/resolve:472:9)
at packageExportsResolve (node:internal/modules/esm/resolve:753:3)
at resolveExports (node:internal/modules/cjs/loader:489:36)
at Module._findPath (node:internal/modules/cjs/loader:529:31)
at Module._resolveFilename (node:internal/modules/cjs/loader:926:27)
at n._resolveFilename (node:electron/js2c/browser_init:249:1105)
at Module._load (node:internal/modules/cjs/loader:785:27)
at c._load (node:electron/js2c/asar_bundle:5:13339)
at Module.require (node:internal/modules/cjs/loader:1012:19)
Activity
WillianAgostini commentedon Nov 13, 2022
Hi @dysolix
You can import the correct adapter like this using [email protected]
or
With version [email protected] and [email protected] the http module is not being exported;
Is throwing this exception.
I'll create a new Issue to solve this