An axios plugin (v2.1.7) that enhances stack traces for axios errors by preserving the call site of the original request, making debugging easier. It works by wrapping axios methods to add a custom error message and the calling context to the stack trace. Currently stable with monthly-ish releases. Compared to alternatives like axios-error, it is lighter and integrates as a simple function call.
npm install axios-better-stacktraceNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates how to install and use the plugin with a custom axios instance to get enhanced stack traces on errors.
Use import axiosBetterStacktrace from 'axios-better-stacktrace' instead of import { axiosBetterStacktrace }.Call axiosBetterStacktrace(instance) immediately after creation, before adding any request/response interceptors.
Check restore before calling, or simply call it once.
Upgrade axios to version 1.x.
const axiosBetterStacktrace = require('axios-better-stacktrace').default;npm install axios-better-stacktrace
Reorder code: apply plugin first, then set up interceptors.
Only call restore once or check if it exists before calling.