Skip to content

fix(core): mock async externals in commonjs output#1418

Merged
9aoy merged 2 commits into
mainfrom
9aoy/fix-cjs-lazy-automock-exports
Jun 15, 2026
Merged

fix(core): mock async externals in commonjs output#1418
9aoy merged 2 commits into
mainfrom
9aoy/fix-cjs-lazy-automock-exports

Conversation

@9aoy

@9aoy 9aoy commented Jun 15, 2026

Copy link
Copy Markdown
Collaborator

Summary

Fixes { mock: true } for CommonJS output when an external ESM module is represented as a promise-returning webpack module. The runtime now waits for async externals to resolve before applying mockObject, so dynamic imports like await import('@rsbuild/core') receive the mocked module namespace instead of a mocked Promise wrapper.

Related Links

#1415

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

@github-actions

github-actions Bot commented Jun 15, 2026

Copy link
Copy Markdown

Rsdoctor Bundle Diff Analysis

Found 13 projects in monorepo, 1 project with changes.

📊 Quick Summary
Project Total Size Change
adapter-rsbuild 5.4 KB 0
adapter-rslib 25.6 KB 0
adapter-rspack 9.3 KB 0
browser 2.0 MB 0
browser-react 6.4 KB 0
browser-ui 809.5 KB 0
coverage-istanbul 18.8 KB 0
coverage-v8 19.4 KB 0
core/browser 1.1 MB 0
core/loaders 869.0 B 0
core/main 1.9 MB +324.0 B (0.0%)
vscode/extension 27.0 MB 0
vscode/worker 14.5 KB 0
📋 Detailed Reports (Click to expand)

📁 core/main

Path: packages/core/.rsdoctor/main/rsdoctor-data.json

📌 Baseline Commit: e67492d747 | PR: #1345

Metric Current Baseline Change
📊 Total Size 1.9 MB 1.9 MB +324.0 B (0.0%)
📄 JavaScript 1.6 MB 1.6 MB +324.0 B (0.0%)
🎨 CSS 0 B 0 B 0
🌐 HTML 0 B 0 B 0
📁 Other Assets 293.7 KB 293.7 KB 0

📦 Download Diff Report: core/main Bundle Diff

Generated by Rsdoctor GitHub Action

@9aoy

9aoy commented Jun 15, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Chef's kiss.

Reviewed commit: 061143d537

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@9aoy 9aoy merged commit 66dc494 into main Jun 15, 2026
34 checks passed
@9aoy 9aoy deleted the 9aoy/fix-cjs-lazy-automock-exports branch June 15, 2026 08:03
@9aoy 9aoy mentioned this pull request Jun 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant