Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: export mergeConfig #5151

merged 2 commits into from Dec 1, 2022


Copy link

Export the mergeConfig utility function, as has been previously requested here.

I believe tacking mergeConfig directly on to the default export is the simplest and most flexible solution, since adding lib/core/mergeConfig.js to the exports of package.json would require additional work on the build step to support CJS – and it also seems like a bit of an anti-pattern to expose individual files like that.

I'm happy to discuss use-cases if anyone needs more convincing, but I think the author of #3905 already did a great job with that. The TL;DR is basically "the ability to merge configs within an interceptor is very useful, and trying to re-create that functionality is error-prone because mergeConfig has a ton of logic that's very specific to axios internals".

Copy link

@kevincennis please check the build it seems to be failing.

Copy link
Contributor Author

Yeah. Some new tests got added after I created the PR. One sec.

@jasonsaayman jasonsaayman merged commit 2687460 into axios:v1.x Dec 1, 2022
7 checks passed
Copy link

Can axios export mergeConfig in index.d.ts file too?

So typescript can use it as

import { mergeConfig } from 'axios';

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

Successfully merging this pull request may close these issues.

None yet

3 participants