axios-inherit (v1.0.1, stable, low release cadence) is a small utility that adds interceptor inheritance to axios. It ensures that any existing interceptors on the global axios instance are inherited by new instances created via axios.create(), and that new interceptors added to the global instance are applied to already existing instances. It also handles interceptor removal. This solves a common pain point when using axios across modules or configuring shared interceptors. It is available on npm, ships TypeScript types, and has a minimal API surface. Similar functionality can be achieved manually, but axios-inherit provides a simple drop-in solution.
npm install axios-inheritNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to install and enable interceptor inheritance on global axios, create a new instance, and add a request interceptor that automatically propagates.
Call axiosInherit(axios) at the earliest point in your application, before creating any instances or adding interceptors.
Use axios.create() to create instances you want to be inheritable.
Call axiosInherit(axios) before adding any interceptors to the global instance.
Ensure axios is imported and the function is called with the axios module object: import axios from 'axios'; import axiosInherit from 'axios-inherit'; axiosInherit(axios);
Run npm install axios-inherit and use correct import: import axiosInherit from 'axios-inherit';
No dependency data recorded yet.