Registry / devops / axios-fetch

axios-fetch

JSON →
library1.1.0jsnpmunverified

Provides a WebAPI Fetch implementation backed by an Axios client instance, allowing pre-configured Axios clients to be used in libraries that require a fetch function, such as Apollo Link HTTP. Version 1.1.0 is the latest stable release. It is a minimal bridge library with no active development since 2019, but it still works for its niche use case. Differentiator: enables reuse of existing Axios interceptors and configuration with fetch-dependent tools.

npm install axios-fetch
INSTALL
IMPORT
SIG · AXIOS-FETCH
A
axios-fetch
devopsjavascriptv1.1.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

buildAxiosFetch
import { buildAxiosFetch } from 'axios-fetch'
const axiosFetch = require('axios-fetch')
Default export does not exist; use named import. CJS require must destructure: const { buildAxiosFetch } = require('axios-fetch')
buildAxiosFetch
const { buildAxiosFetch } = require('axios-fetch')
const buildAxiosFetch = require('axios-fetch')
CommonJS users must destructure the named export
buildAxiosFetch
import { buildAxiosFetch } from 'axios-fetch'
import buildAxiosFetch from 'axios-fetch'
No default export; must use named import syntax

Shows how to create a fetch function from an Axios instance and use it in Apollo Link HTTP or as a standard fetch replacement.

import { buildAxiosFetch } from 'axios-fetch'; import axios from 'axios'; // Create an Axios instance with custom config const axiosInstance = axios.create({ baseURL: 'https://api.example.com', timeout: 5000, headers: { 'X-Custom-Header': 'foobar' } }); // Build a fetch-compatible function from the Axios instance const fetch = buildAxiosFetch(axiosInstance); // Use it as a drop-in for fetch() fetch('/data') .then(response => response.json()) .then(data => console.log(data)) .catch(err => console.error(err)); // Example with Apollo Link HTTP import { createHttpLink } from 'apollo-link-http'; const link = createHttpLink({ uri: '/graphql', fetch: fetch });
Debug
Known issues
gotchaThe library does not expose a default export; always use named import { buildAxiosFetch }.
fix
Use named import syntax: import { buildAxiosFetch } from 'axios-fetch'
affects: >=0.1.0
gotchaPassing undefined or null as axiosInstance without error handling will throw.
fix
Ensure you pass a valid Axios instance created with axios.create() or the default axios.
affects: >=0.1.0
deprecatedThe package is in maintenance mode; no new features or updates since 2019. Check compatibility with newer axios versions.
fix
Test with your axios version; if issues arise, consider implementing a custom fetch wrapper using axios directly.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: axiosFetch is not a function
Using default import when only named export exists
fix
Use import { buildAxiosFetch } from 'axios-fetch' or const { buildAxiosFetch } = require('axios-fetch')
TypeError: Cannot destructure property 'buildAxiosFetch' of '...' as it is undefined.
Package not installed or import path incorrect
fix
Run npm install axios-fetch and ensure the import statement is correct
Upgrade
Version history
1.1.0latest on npm
Audit
Dependencies
axiosrequiredUses Axios client as the underlying HTTP client
Agent activity
16 hits · last 30 days
node
14
Amazon
1
OpenAI (training)
1
Resources
axios-fetch — npm install axios-fetch · libregistry