Skip to content

Comments

fix: esm export * from 'externalized-dep' generates unnecessary code#5612

Merged
IWANABETHATGUY merged 1 commit intomainfrom
08-05-fix_4472
Aug 5, 2025
Merged

fix: esm export * from 'externalized-dep' generates unnecessary code#5612
IWANABETHATGUY merged 1 commit intomainfrom
08-05-fix_4472

Conversation

@IWANABETHATGUY
Copy link
Member

@IWANABETHATGUY IWANABETHATGUY commented Aug 5, 2025

image

Closed #4472

  1. Added hoistable entryLevelExternal definition
    /// If a record is a re-export-all from an external module, and that re-export-all chain continues uninterrupted to the entry point,
    /// we can reuse the original re-export-all declaration instead of generating complex interoperability code.
  2. Record the module namespace included reason, it is used to rewind in some special scenarios (e.g. the module namespace is only included due to reexport ofan external module)

Copy link
Member Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@netlify
Copy link

netlify bot commented Aug 5, 2025

Deploy Preview for rolldown-rs canceled.

Name Link
🔨 Latest commit 41f49be
🔍 Latest deploy log https://app.netlify.com/projects/rolldown-rs/deploys/6891f129993e5f00083b19af

@IWANABETHATGUY IWANABETHATGUY changed the title fix: 4472 fix: remove unnecessary interop code if external module could treated as reexport from entry module Aug 5, 2025
@IWANABETHATGUY IWANABETHATGUY marked this pull request as ready for review August 5, 2025 09:26
@IWANABETHATGUY IWANABETHATGUY changed the title fix: remove unnecessary interop code if external module could treated as reexport from entry module fix: remove unnecessary interop code if any reexport external module could treated as reexport from entry module Aug 5, 2025
@IWANABETHATGUY IWANABETHATGUY marked this pull request as draft August 5, 2025 09:30
@codspeed-hq
Copy link

codspeed-hq bot commented Aug 5, 2025

CodSpeed Performance Report

Merging #5612 will not alter performance

Comparing 08-05-fix_4472 (41f49be) with main (77bbeab)

Summary

✅ 8 untouched benchmarks

@github-actions
Copy link
Contributor

github-actions bot commented Aug 5, 2025

Benchmarks Rust

group                                                        pr                                     target
-----                                                        --                                     ------
bundle/bundle@multi-duplicated-top-level-symbol              1.00     84.2±3.24ms        ? ?/sec    1.00     83.7±3.68ms        ? ?/sec
bundle/bundle@multi-duplicated-top-level-symbol-sourcemap    1.01     94.1±3.75ms        ? ?/sec    1.00     93.2±2.57ms        ? ?/sec
bundle/bundle@rome_ts                                        1.14   137.1±39.02ms        ? ?/sec    1.00    120.7±3.78ms        ? ?/sec
bundle/bundle@rome_ts-sourcemap                              1.09   153.3±33.07ms        ? ?/sec    1.00    141.0±2.46ms        ? ?/sec
bundle/bundle@threejs                                        1.00     44.4±3.72ms        ? ?/sec    1.08     47.7±6.40ms        ? ?/sec
bundle/bundle@threejs-sourcemap                              1.00     53.2±1.92ms        ? ?/sec    1.06     56.2±4.17ms        ? ?/sec
bundle/bundle@threejs10x                                     1.00    456.8±7.38ms        ? ?/sec    1.04   473.4±42.94ms        ? ?/sec
bundle/bundle@threejs10x-sourcemap                           1.00    544.1±7.96ms        ? ?/sec    1.00   546.3±36.73ms        ? ?/sec
scan/scan@rome_ts                                            1.00     96.1±2.31ms        ? ?/sec    1.00     96.3±2.68ms        ? ?/sec
scan/scan@threejs                                            1.04     33.5±2.26ms        ? ?/sec    1.00     32.3±2.12ms        ? ?/sec
scan/scan@threejs10x                                         1.00   340.8±25.47ms        ? ?/sec    1.00   340.3±11.21ms        ? ?/sec

@IWANABETHATGUY IWANABETHATGUY force-pushed the 08-05-fix_4472 branch 4 times, most recently from 71d7609 to f43eddd Compare August 5, 2025 11:19
@pkg-pr-new
Copy link

pkg-pr-new bot commented Aug 5, 2025

Open in StackBlitz

@rolldown/browser

npm i https://pkg.pr.new/@rolldown/browser@5612

@rolldown/debug

npm i https://pkg.pr.new/@rolldown/debug@5612

@rolldown/pluginutils

npm i https://pkg.pr.new/@rolldown/pluginutils@5612

rolldown

npm i https://pkg.pr.new/rolldown@5612

@rolldown/binding-android-arm64

npm i https://pkg.pr.new/@rolldown/binding-android-arm64@5612

@rolldown/binding-darwin-arm64

npm i https://pkg.pr.new/@rolldown/binding-darwin-arm64@5612

@rolldown/binding-darwin-x64

npm i https://pkg.pr.new/@rolldown/binding-darwin-x64@5612

@rolldown/binding-freebsd-x64

npm i https://pkg.pr.new/@rolldown/binding-freebsd-x64@5612

@rolldown/binding-linux-arm-gnueabihf

npm i https://pkg.pr.new/@rolldown/binding-linux-arm-gnueabihf@5612

@rolldown/binding-linux-arm64-gnu

npm i https://pkg.pr.new/@rolldown/binding-linux-arm64-gnu@5612

@rolldown/binding-linux-arm64-musl

npm i https://pkg.pr.new/@rolldown/binding-linux-arm64-musl@5612

@rolldown/binding-linux-arm64-ohos

npm i https://pkg.pr.new/@rolldown/binding-linux-arm64-ohos@5612

@rolldown/binding-linux-x64-gnu

npm i https://pkg.pr.new/@rolldown/binding-linux-x64-gnu@5612

@rolldown/binding-linux-x64-musl

npm i https://pkg.pr.new/@rolldown/binding-linux-x64-musl@5612

@rolldown/binding-wasm32-wasi

npm i https://pkg.pr.new/@rolldown/binding-wasm32-wasi@5612

@rolldown/binding-win32-arm64-msvc

npm i https://pkg.pr.new/@rolldown/binding-win32-arm64-msvc@5612

@rolldown/binding-win32-ia32-msvc

npm i https://pkg.pr.new/@rolldown/binding-win32-ia32-msvc@5612

@rolldown/binding-win32-x64-msvc

npm i https://pkg.pr.new/@rolldown/binding-win32-x64-msvc@5612

commit: f43eddd

@IWANABETHATGUY IWANABETHATGUY marked this pull request as ready for review August 5, 2025 11:49
@IWANABETHATGUY IWANABETHATGUY changed the title fix: remove unnecessary interop code if any reexport external module could treated as reexport from entry module fix: esm export * from 'externalized-dep' generates unnecessary code Aug 5, 2025
@IWANABETHATGUY IWANABETHATGUY added this pull request to the merge queue Aug 5, 2025
Merged via the queue into main with commit c8799eb Aug 5, 2025
26 checks passed
@IWANABETHATGUY IWANABETHATGUY deleted the 08-05-fix_4472 branch August 5, 2025 12:09
shulaoda added a commit that referenced this pull request Aug 11, 2025
## [1.0.0-beta.32] - 2025-08-11

### 💥 BREAKING CHANGES

- advanceChunks: remove interaction between `advanceChunks` and `preserveEntrySignatures` (#5629) by @hyf0
- types: align `TreeshakingOptions` type with Rollup (#5592) by @sapphi-red

### 🚀 Features

- rolldown_plugin_manifest: support legacy (#5694) by @shulaoda
- rolldown_plugin_vite_css: align load hook logic (#5667) by @shulaoda
- rolldown_plugin_transform: throw error for invalid tsconfig (#5657) by @shulaoda
- support `context` option (#5631) by @7086cmd
- rolldown: oxc v0.81.0 (#5642) by @Boshen
- include plugin name in the message of UNHANDLEABLE_ERRORs that happened in plugins (#5636) by @sapphi-red
- pass plugin name to log (#5635) by @sapphi-red
- rolldown_plugin_import_glob: support glob-safe paths (#5640) by @shulaoda
- rolldown_binding: Add configurable max_blocking_threads with environment variable override (#5559) by @Copilot
- output better error message for callable plugins (#5632) by @sapphi-red
- rolldown_plugin_manifest: support names for asset (#5627) by @shulaoda
- rolldown_plugin_manifest: align the logic related to css entries (#5626) by @shulaoda
- hmr: handle `import ... from 'external-module'` in rolldown's best (#5599) by @hyf0
- add array support for `treeshake.moduleSideEffects` option (#5593) by @sapphi-red

### 🐛 Bug Fixes

- ensure `./` prefix for relative imports starting with `.` (#5687) by @shulaoda
- hmr: fix regression test `deconflict_import_bindings` (#5684) by @hyf0
- hmr: only modules in the propagation chain need to re-execute (#5683) by @hyf0
- preserve empty `export {}` to ensure correct ESM detection (#5686) by @shulaoda
- vite test failed (#5675) by @IWANABETHATGUY
- incorrect module execution order with sideeffectful CJS module (#5661) by @IWANABETHATGUY
- rollup-tests: update ignored tests for `option.context` (#5669) by @situ2001
- hmr: ensure correctness of `typeof require === 'function'` (#5651) by @hyf0
- hmr: rewrite `this` to `exports` for cjs modules (#5641) by @hyf0
- don't generate namespace reexport code for reexport external record that has been moved to entry point (#5622) by @IWANABETHATGUY
- esm export * from 'externalized-dep' generates unnecessary code (#5612) by @IWANABETHATGUY
- hmr: correct runtime behavior for manual reexports (#5614) by @hyf0
- ci: resolve potential sync issue in `this.emitFile` (#5611) by @shulaoda
- hmr: support re-assignment on `module.exports` (#5607) by @hyf0
- hmr: rewrite `require(...)` to sensible form (#5604) by @hyf0
- align behavior when returning `undefined` from `treeshake.moduleSideEffects` function (#5595) by @sapphi-red

### 🚜 Refactor

- rolldown_binding: improve the use of `FxHashSet` and `FxHashMap` (#5665) by @shulaoda
- hmr: move constants to `constants.rs` (#5650) by @hyf0
- hmr: rewrite `exports,module` to `__rolldown_exports__,__rolldown_module__` (#5647) by @hyf0
- hmr: migrate `VisitMut` to `Traverse` (#5646) by @hyf0
- use `bit_index` function to get `RuntimeHelper` bit index (#5634) by @IWANABETHATGUY
- improve `JsCallback` and `MaybeAsyncJsCallback` (#5628) by @shulaoda
- use bitflags instead of boolean to represent module_namespace included reason (#5621) by @IWANABETHATGUY
- rolldown_debug,rolldown_tracing: remove `EnvFilter` (#5231) by @Boshen
- align parameter name for `treeshake.moduleSideEffects` (#5594) by @sapphi-red

### 📚 Documentation

- contrib-guide: add CPU profile steps (#5677) by @sapphi-red
- rollup-tests: update README to correct  commands (#5658) by @situ2001

### ⚡ Performance

- reduce memory usage when calc none wrapped modules implicit dependency (#5679) by @IWANABETHATGUY
- hmr: do codegen in parallel (#5590) by @hyf0

### 🧪 Testing

- Runtime error when using rolldown to build a page using tinymce (#5678) by @IWANABETHATGUY
- rollup: enable testing for `option.context` (#5663) by @situ2001
- hmr: run patch exectution after the normal execution (#5645) by @sapphi-red
- hmr: properly execute patch chunks (#5617) by @sapphi-red
- rust/hmr: hide unnecessary rolldown runtime, hmr module (#5606) by @hyf0
- rust/hmr: support writting assertion tests (#5598) by @hyf0
- rust: simplify global variable injection logic (#5597) by @hyf0

### ⚙️ Miscellaneous Tasks

- deps: lock file maintenance (#5693) by @renovate[bot]
- deps: lock file maintenance (#5692) by @renovate[bot]
- deps: lock file maintenance rust crates (#5691) by @renovate[bot]
- deps: update github-actions (#5688) by @renovate[bot]
- deps: lock file maintenance npm packages (#5690) by @renovate[bot]
- deps: update github-actions (major) (#5689) by @renovate[bot]
- upgrade NAPI-RS to 3.2 (#5680) by @Brooooooklyn
- deps: update dependency tsdown to v0.14.0 (#5681) by @renovate[bot]
- clean up basic-vue example (#5676) by @IWANABETHATGUY
- deps: update crate-ci/typos action to v1.35.3 (#5674) by @renovate[bot]
- remove duplicate hook tracing (#5673) by @IWANABETHATGUY
- deps: update dependency tsdown to v0.13.4 (#5668) by @renovate[bot]
- deps: update dependency rolldown-plugin-dts to v0.15.6 (#5666) by @renovate[bot]
- deps: update crate-ci/typos action to v1.35.2 (#5664) by @renovate[bot]
- deps: update dependency rust to v1.89.0 (#5652) by @renovate[bot]
- deps: update dependency rolldown-plugin-dts to v0.15.5 (#5649) by @renovate[bot]
- deps: update dependency rolldown-plugin-dts to v0.15.4 (#5638) by @renovate[bot]
- add `just debug-test` alias to run test without extended test case (#5633) by @IWANABETHATGUY
- update lable related to auto labeled documentation ci (#5630) by @IWANABETHATGUY
- clippy: allow `case_sensitive_file_extension_comparisons` (#5625) by @shulaoda
- fix wasi build failed (#5624) by @sapphi-red
- use env variable to control whether run extended tests (#5623) by @IWANABETHATGUY
- remove redundant track_caller (#5620) by @IWANABETHATGUY
- replace unmaintained goto-bus-stop/setup-zig with mlugg/setup-zig action (#5605) by @Copilot
- deps: update crate-ci/typos action to v1.35.1 (#5603) by @renovate[bot]
- deps: update crate-ci/typos action to v1.35.0 (#5601) by @renovate[bot]
- deps: update dependency tsdown to v0.13.3 (#5602) by @renovate[bot]
- deps: update dependency rolldown-plugin-dts to v0.15.3 (#5600) by @renovate[bot]

Co-authored-by: shulaoda <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: esm export * from 'externalized-dep' generates unnecessary code

2 participants