Skip to content

fix(esm-library): emit empty export for empty node chunks#13462

Merged
JSerFeng merged 4 commits intoweb-infra-dev:mainfrom
JSerFeng:fy/esm-node-empty-export
Apr 2, 2026
Merged

fix(esm-library): emit empty export for empty node chunks#13462
JSerFeng merged 4 commits intoweb-infra-dev:mainfrom
JSerFeng:fy/esm-node-empty-export

Conversation

@JSerFeng
Copy link
Copy Markdown
Contributor

Summary

  • emit export {} for node-target ESM chunks when a chunk has no exports
  • update the ESM output snapshot for the empty import case

Related links

  • N/A

Checklist

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

Copilot AI review requested due to automatic review settings March 25, 2026 03:51
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Ensures Node-target ESM library chunks remain valid ESM even when they contain no exports by emitting an explicit empty export, and updates the corresponding snapshot.

Changes:

  • Add conditional emission of export {}; for Node ESM chunks with no exports
  • Update snapshot output for the “empty import” external case

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
tests/rspack-test/esmOutputCases/externals/empty-import/snapshots/esm.snap.txt Updates snapshot to include the new export {}; emission
crates/rspack_plugin_esm_library/src/render.rs Adds logic to render an empty export for Node ESM output when no exports are present

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread crates/rspack_plugin_esm_library/src/render.rs
Comment thread crates/rspack_plugin_esm_library/src/render.rs
@github-actions github-actions Bot added the release: bug fix release: bug related release(mr only) label Mar 25, 2026
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Mar 25, 2026

Merging this PR will not alter performance

🎉 Hooray! codspeed-node just leveled up to 5.2.0!

A heads-up, this is a breaking change and it might affect your current performance baseline a bit. But here's the exciting part - it's packed with new, cool features and promises improved result stability 🥳!
Curious about what's new? Visit our releases page to delve into all the awesome details about this new version.

✅ 9 untouched benchmarks
⏩ 26 skipped benchmarks1


Comparing JSerFeng:fy/esm-node-empty-export (7c092e2) with main (1ef9d36)

Open in CodSpeed

Footnotes

  1. 26 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@JSerFeng JSerFeng force-pushed the fy/esm-node-empty-export branch from 2e95380 to 890cb5f Compare March 27, 2026 10:01
@JSerFeng JSerFeng force-pushed the fy/esm-node-empty-export branch from 890cb5f to a142f60 Compare March 31, 2026 04:07
@JSerFeng JSerFeng enabled auto-merge (squash) April 2, 2026 06:02
@JSerFeng JSerFeng merged commit 0638430 into web-infra-dev:main Apr 2, 2026
36 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release: bug fix release: bug related release(mr only)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants