Skip to content

fix: fix export for React Native and Browserify#7386

Merged
jasonsaayman merged 1 commit intoaxios:v1.xfrom
Gudahtt:fix-browserify-react-native-export
Feb 10, 2026
Merged

fix: fix export for React Native and Browserify#7386
jasonsaayman merged 1 commit intoaxios:v1.xfrom
Gudahtt:fix-browserify-react-native-export

Conversation

@Gudahtt
Copy link
Contributor

@Gudahtt Gudahtt commented Feb 9, 2026

Browserify and React Native projects (that aren't using unstable_enablePackageExports) use the main field as the package

entrypoint. A recent PR (#5756) updated main to use a CommonJS bundle for Node.js, which caused Browserify and React Native projects to use the Node.js bundle. This led to many reports of broken React Native builds.

This has been fixed by adding an entry to browser and react-native to re-map the Node.js CommonJS bundle to the browser CommonJS bundle.

Fixes #7357


Summary by cubic

Remaps the Node.js CJS entry to the browser CJS bundle for Browserify and React Native so they don’t import the Node build. Fixes #7357 and resolves RN build breakage introduced by the updated main field.

Description

  • Added package.json mappings:
    • browser["./dist/node/axios.cjs"] -> "./dist/browser/axios.cjs"
    • react-native["./dist/node/axios.cjs"] -> "./dist/browser/axios.cjs"
  • Keeps existing remaps for http adapter, platform, and FormData.
  • Ensures Browserify and RN (without unstable_enablePackageExports) use the browser bundle.

Testing

  • No tests changed; export maps only.
  • Manual checks:
    • Bundle with Browserify and confirm browser CJS is used.
    • Build a React Native app and verify no Node modules are pulled.

Written for commit c188c0a. Summary will update on new commits.

Browserify and React Native projects (that aren't using
`unstable_enablePackageExports`) use the `main` field as the package

entrypoint. A recent PR (axios#5756) updated `main` to use a CommonJS bundle
for Node.js, which caused Browserify and React Native projects to
use the Node.js bundle. This led to many reports of broken React Native
builds.

This has been fixed by adding an entry to `browser` and `react-native`
to re-map the Node.js CommonJS bundle to the browser CommonJS bundle.
@Gudahtt Gudahtt force-pushed the fix-browserify-react-native-export branch from 3a47986 to c188c0a Compare February 9, 2026 22:43
@Gudahtt Gudahtt marked this pull request as ready for review February 9, 2026 22:44
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 1 file

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

@jasonsaayman jasonsaayman self-assigned this Feb 10, 2026
@jasonsaayman jasonsaayman added priority::high A high priority issue commit::fix The PR is related to a bugfix labels Feb 10, 2026
Copy link
Member

@jasonsaayman jasonsaayman left a comment

Choose a reason for hiding this comment

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

LGTM 🔥

@jasonsaayman jasonsaayman merged commit 335b79f into axios:v1.x Feb 10, 2026
6 checks passed
@vishaal-workhall
Copy link

When is this fix expected to be releasing ?? @jasonsaayman

@Zeeshan404
Copy link

When is this going to be release ?

@rklomp
Copy link

rklomp commented Feb 14, 2026

@jasonsaayman Can we get a new release with this?

@jasonsaayman
Copy link
Member

yeah will be doing soon thanks, just want to see if can add a couple more additions to that release

@vishaal-workhall
Copy link

yeah will be doing soon thanks, just want to see if can add a couple more additions to that release

it would be really helpful if we get it soon

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

Labels

commit::fix The PR is related to a bugfix priority::high A high priority issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Axios 1.13.3/4 break with React Native

5 participants