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

fix problem with named export axios #5104

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions index.d.ts
Expand Up @@ -480,4 +480,5 @@ export interface AxiosStatic extends AxiosInstance {

declare const axios: AxiosStatic;

export { axios };
export default axios;
3 changes: 2 additions & 1 deletion index.js
Expand Up @@ -28,5 +28,6 @@ export {
Cancel,
isAxiosError,
spread,
toFormData
toFormData,
axios
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, this should not be necessary you can already do this:

import { axios } from 'axios';

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please see my updated PR description. You can check out my repro at akphi/issue-repo#12
There are 2 problems:

  1. For ESM import, I don't think import { axios } from 'axios'; work
  2. For TS, we need to update the typings to have the named export - I just updated the PR with this change

}