Skip to content

Comments

fix(hmr): generate unique import binding#4849

Merged
sapphi-red merged 1 commit intomainfrom
fix/hmr-duplicate-import-binding
Jun 6, 2025
Merged

fix(hmr): generate unique import binding#4849
sapphi-red merged 1 commit intomainfrom
fix/hmr-duplicate-import-binding

Conversation

@sapphi-red
Copy link
Member

The HMR patch chunk contained a code like:

var import_react = __rolldown_runtime__.__toESM(__rolldown_runtime__.loadExports("node_modules/.pnpm/[email protected]/node_modules/react/index.js"));
var import_react = __rolldown_runtime__.loadExports("src/assets/react.svg");

This PR fixes this by adding the import index.

The new output:

var import_react_1 = __rolldown_runtime__.__toESM(__rolldown_runtime__.loadExports("node_modules/.pnpm/[email protected]/node_modules/react/index.js"));
var import_react_2 = __rolldown_runtime__.loadExports("src/assets/react.svg");

@netlify
Copy link

netlify bot commented Jun 6, 2025

Deploy Preview for rolldown-rs canceled.

Name Link
🔨 Latest commit 8a51962
🔍 Latest deploy log https://app.netlify.com/projects/rolldown-rs/deploys/6842dbdf60fc1200082487b0

@sapphi-red sapphi-red marked this pull request as draft June 6, 2025 12:18
@github-actions
Copy link
Contributor

github-actions bot commented Jun 6, 2025

Benchmarks Rust

group                                                        pr                                     target
-----                                                        --                                     ------
bundle/bundle@multi-duplicated-top-level-symbol              1.08     90.6±3.41ms        ? ?/sec    1.00     84.2±2.99ms        ? ?/sec
bundle/bundle@multi-duplicated-top-level-symbol-sourcemap    1.02    100.7±2.98ms        ? ?/sec    1.00     98.2±2.81ms        ? ?/sec
bundle/bundle@rome_ts                                        1.00    122.6±2.91ms        ? ?/sec    1.00    123.2±2.24ms        ? ?/sec
bundle/bundle@rome_ts-sourcemap                              1.00    139.2±3.65ms        ? ?/sec    1.00    139.1±3.37ms        ? ?/sec
bundle/bundle@threejs                                        1.00     44.0±1.48ms        ? ?/sec    1.01     44.6±2.26ms        ? ?/sec
bundle/bundle@threejs-sourcemap                              1.00     50.8±2.76ms        ? ?/sec    1.00     50.7±1.04ms        ? ?/sec
bundle/bundle@threejs10x                                     1.01    469.8±9.06ms        ? ?/sec    1.00    467.0±4.96ms        ? ?/sec
bundle/bundle@threejs10x-sourcemap                           1.02    548.8±7.02ms        ? ?/sec    1.00    540.1±6.27ms        ? ?/sec
scan/scan@rome_ts                                            1.03     97.0±2.63ms        ? ?/sec    1.00     94.0±2.03ms        ? ?/sec
scan/scan@threejs                                            1.00     33.1±0.73ms        ? ?/sec    1.00     33.0±0.80ms        ? ?/sec
scan/scan@threejs10x                                         1.01    343.9±4.64ms        ? ?/sec    1.00    339.2±5.16ms        ? ?/sec

@sapphi-red sapphi-red marked this pull request as ready for review June 6, 2025 13:03
@sapphi-red
Copy link
Member Author

I'll write a test in a separate PR as the repo doesn't have the infra to write one yet.

Copy link
Member

@hyf0 hyf0 left a comment

Choose a reason for hiding this comment

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

Nice.

@sapphi-red sapphi-red added this pull request to the merge queue Jun 6, 2025
Merged via the queue into main with commit 56a2214 Jun 6, 2025
24 checks passed
@sapphi-red sapphi-red deleted the fix/hmr-duplicate-import-binding branch June 6, 2025 13:38
github-merge-queue bot pushed a commit that referenced this pull request Jun 10, 2025
This PR adds a test for #4849.
Boshen pushed a commit that referenced this pull request Jun 10, 2025
## [1.0.0-beta.14] - 2025-06-10

### 💥 BREAKING CHANGES

- refactor!: move preserveEntrySignatures from output to input options
by @IWANABETHATGUY in
[#4871](#4871)

### 🚀 Features

- feat(strictExecutionOrder): no need to generate plain chunk imports
for addressing side effects by @hyf0 in
[#4890](#4890)
- feat: make wasm fallback plugin callable in node by @shulaoda in
[#4885](#4885)
- feat(rolldown_plugin_module_preload_polyfill): align with
`rolldown-vite` by @shulaoda in
[#4884](#4884)
- feat(attachDebugInfo): improve format and distinguish dynamic entries
by @hyf0 in [#4861](#4861)

### 🐛 Bug Fixes

- fix(binding): preserveModules infinity loop by @Brooooooklyn in
[#4879](#4879)
- fix: dynamic import does not return exports when
preserveEntrySignatures: false is set and the importee is an entry by
@IWANABETHATGUY in
[#4891](#4891)
- fix: preserveEntrySignatures panics with an edge case by
@IWANABETHATGUY in
[#4877](#4877)
- fix: directives are missing with `preserveModules` by @IWANABETHATGUY
in [#4876](#4876)
- fix: exports from dynamically imported chunks are removed by
@IWANABETHATGUY in
[#4875](#4875)

### 🚜 Refactor

- refactor: clearify Chunk entry kind by @IWANABETHATGUY in
[#4892](#4892)
- refactor(rolldown_plugin_build_import_analysis): align the logic with
`rolldown-vite` by @shulaoda in
[#4856](#4856)

### 📚 Documentation

- docs(contrib-guide): add HMR testing section by @sapphi-red in
[#4888](#4888)
- docs(guide): update release channels - remove nightly, add pkg.pr.new
by @Boshen in [#4881](#4881)

### 🧪 Testing

- test: rename `rolldown/topics/hmr/mutiply-entires` to snake case by
@sapphi-red in [#4889](#4889)
- test: add test for #4849 by @sapphi-red in
[#4887](#4887)
- test: setup infra for hmr tests by @sapphi-red in
[#4886](#4886)

### ⚙️ Miscellaneous Tasks

- ci: disable publish to nightly by @Boshen in
[#4874](#4874)
- ci: extend Vite tests timeout by @sapphi-red in
[#4870](#4870)
- fix publish-to-npm.yml by @Boshen

### ◀️ Revert

- revert: "refactor(rolldown_plugin_load_fallback): align with
rolldown-vite" by @shulaoda in
[#4868](#4868)

Co-authored-by: shulaoda <[email protected]>
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.

2 participants