Skip to content

feat: optimize star exports from externals#13050

Open
JSerFeng wants to merge 2 commits intomainfrom
feat/optimize-star-re-exports-external
Open

feat: optimize star exports from externals#13050
JSerFeng wants to merge 2 commits intomainfrom
feat/optimize-star-re-exports-external

Conversation

@JSerFeng
Copy link
Contributor

Summary

Optimize star reexports from external module, make module with unknown reexports have static exports info

Fix path rendering bug, file with dot prefix should render as './' + file

Related links

Checklist

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

Copilot AI review requested due to automatic review settings February 12, 2026 07:46
@chatgpt-codex-connector
Copy link

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@github-actions github-actions bot added release: feature release: feature related release(mr only) team The issue/pr is created by the member of Rspack. labels Feb 12, 2026
Copy link
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

This PR optimizes star re-exports from external modules and fixes a path rendering bug for files with dot prefixes. The optimization allows modules with unknown re-exports to have static exports info, improving code generation for ESM library output.

Changes:

  • Added optimization logic to disable redundant side-effect imports when star re-exporting from external modules, rendering them as top-level export * from statements
  • Fixed path rendering bug where files with dot prefix (e.g., .hidden/file.js) were not getting the required ./ prefix for ESM imports
  • Refactored ESM library plugin to move module marking logic to optimize_dependencies hook for better timing

Reviewed changes

Copilot reviewed 17 out of 18 changed files in this pull request and generated no comments.

Show a summary per file
File Description
crates/rspack_plugin_rslib/src/dyn_import_external.rs Added cutout_star_re_export_externals function and ExportImportedDependencyTemplate to optimize star re-exports from externals; renamed cutout_dyn_import_external to cutout_dyn_import_externals
crates/rspack_plugin_rslib/src/plugin.rs Integrated new star re-export optimization, registered ExportImportedDependencyTemplate, and updated function call to use renamed function
crates/rspack_plugin_rslib/src/parser_plugin.rs Changed intercept_api_plugin field visibility from public to private for better encapsulation
crates/rspack_plugin_rslib/Cargo.toml Added rspack_collections and rustc-hash dependencies needed for the optimization logic
crates/rspack_plugin_esm_library/src/plugin.rs Fixed path rendering to check for ./ and ../ prefixes instead of just .; refactored module marking into separate method; moved hook registration order; replaced ExternalModuleInfo::new() calls with explicit struct initialization
crates/rspack_plugin_esm_library/src/link.rs Added connection activity check before processing re-exports and used connection's module identifier directly
tests/rspack-test/esmOutputCases/externals/star-re-export/* New test case verifying star re-exports from externals are rendered at top level
tests/rspack-test/esmOutputCases/externals/runtime-decide/* New test case for modules with dynamic exports that are decided at runtime
tests/rspack-test/esmOutputCases/basic/hidden-folder/* New test case verifying files in dot-prefixed folders are rendered with correct ./ prefix
Cargo.lock Updated dependencies for rspack_plugin_rslib

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

@JSerFeng JSerFeng enabled auto-merge (squash) February 12, 2026 07:52
@github-actions
Copy link
Contributor

github-actions bot commented Feb 12, 2026

📦 Binary Size-limit

Comparing 938cb97 to chore(deps): remove simd-adler32 crate patch (#13045) by pshu

❌ Size increased by 12.25KB from 48.68MB to 48.70MB (⬆️0.02%)

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Feb 13, 2026

Deploying rspack with  Cloudflare Pages  Cloudflare Pages

Latest commit: 938cb97
Status: ✅  Deploy successful!
Preview URL: https://b7404ae0.rspack-v2.pages.dev
Branch Preview URL: https://feat-optimize-star-re-export.rspack-v2.pages.dev

View logs

@github-actions
Copy link
Contributor

Rsdoctor Bundle Diff Analysis

Found 5 projects in monorepo, 0 projects with changes.

📊 Quick Summary
Project Total Size Change
react-10k 5.7 MB 0
react-1k 825.4 KB 0
react-5k 2.7 MB 0
rome 984.2 KB 0
ui-components 2.2 MB 0

Generated by Rsdoctor GitHub Action

@codspeed-hq
Copy link

codspeed-hq bot commented Feb 13, 2026

Merging this PR will improve performance by 65.29%

⚡ 2 improved benchmarks
✅ 15 untouched benchmarks
⏩ 1 skipped benchmark1

Performance Changes

Benchmark BASE HEAD Efficiency
bundle@threejs-development 815.1 ms 735.8 ms +10.79%
rust@build_module_graph 2.6 s 1.6 s +65.29%

Comparing feat/optimize-star-re-exports-external (938cb97) with main (f2d8d0a)

Open in CodSpeed

Footnotes

  1. 1 benchmark was skipped, so the baseline result was used instead. If it was deleted from the codebase, click here and archive it to remove it from the performance reports.

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

Labels

release: feature release: feature related release(mr only) team The issue/pr is created by the member of Rspack.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant