Skip to content

fix: resolveConfig arrow function breaks under webpack + babel transforms#10891

Merged
jasonsaayman merged 2 commits into
axios:v1.xfrom
sapirbaruch:fix/v1x-resolve-config-webpack-babel-export
May 24, 2026
Merged

fix: resolveConfig arrow function breaks under webpack + babel transforms#10891
jasonsaayman merged 2 commits into
axios:v1.xfrom
sapirbaruch:fix/v1x-resolve-config-webpack-babel-export

Conversation

@sapirbaruch

@sapirbaruch sapirbaruch commented May 14, 2026

Copy link
Copy Markdown
Contributor

Ran into this while bundling an app with webpack 5 + babel. The arrow function
used as the default export in resolveConfig.js causes __WEBPACK_DEFAULT_EXPORT__
to resolve to undefined under certain babel plugin configurations (specifically
with @babel/plugin-transform-modules-commonjs and module interop settings).

Converting it to a named function export resolves the issue without any
behavioral changes.

Tested with the repro case from #10675.


Summary by cubic

Fixes an issue where resolveConfig’s default export could be undefined when bundling with webpack 5 + babel CommonJS transforms. Converts the arrow default export to a named function and re-exports it as default; no behavior or API changes.

Description

  • Change: convert arrow default export to named resolveConfig and default-export it.
  • Reason: @babel/plugin-transform-modules-commonjs can break arrow default exports in webpack 5, causing __WEBPACK_DEFAULT_EXPORT__ to be undefined.
  • Context: Verified with the repro; merged latest v1.x into this branch with no additional code changes.
  • Docs: none required; optional note in /docs/ about babel CommonJS interop and default exports.
  • Semver: patch.

Testing

  • No test changes; existing tests cover resolveConfig.
  • Recommended: add an integration build test using webpack 5 + @babel/plugin-transform-modules-commonjs to prevent regressions.

Written for commit eb5978c. Summary will update on new commits. Review in cubic

@sapirbaruch sapirbaruch requested a review from jasonsaayman as a code owner May 14, 2026 08:43

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

Copy link
Copy Markdown
Contributor

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 added priority::medium A medium priority commit::fix The PR is related to a bugfix labels May 14, 2026
jasonsaayman

This comment was marked as resolved.

@jasonsaayman jasonsaayman merged commit b0771a3 into axios:v1.x May 24, 2026
26 checks passed
jasonsaayman added a commit that referenced this pull request May 28, 2026
…ck/babel compatibility (#10891)

Co-authored-by: Jay <jasonsaayman@gmail.com>
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::medium A medium priority

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants