Skip to content

[Bug]: chunk-optimization dedupe rewrites dynamic-import target without remapping .default accessor #9446

@danielroe

Description

@danielroe

Reproduction link or steps

https://repl.rolldown.rs/#eNplkMFugzAMhl/FyiWgQbpekdhL9MqFgdmYgjM5oSqivPsSomwdvcWx/fv7/1UMolrFSD3elLPhTaL6qwvRhXL6NuxgBbtMsMHAZgKpTp0ekVxpSC/qy8qGGsLbPtnj0M7awTBT50ZD4Od4gSyHtSEARjczgbTIV+Ryb5ZpR8ILXByP9JH5c3lD24NwZ8g6YDM7tFBHNXmSVZCu3yCCZp5tHwlUeeEVvA8UleMZt0KkVjL7W0ezBwv7CW3aPjI9XzqkkCv3iZRxGGKVVO534EjiAf5vJIzDb4Q5GA/513BZpnejM/mwIX1OT+nL9Ij/MqYwtNri5jGuXv+sXtVZbD/8MK5d

What is expected?

I expect that the lazy import has the (r) => r.default || r to be rewritten to point to the correct named export

What is actually happening?

client-only.js is merged into index.js. The dynamic-import target gets rewritten from ./client-only.js to ./index.js, but the .then(r => r.default || r) accessor is left as-is, so it reads index.js's default export (the entry function):

System Info

- rolldown: 1.0.1
- node: 22.x
- repro reproduces on macOS arm64 and Linux arm64

Any additional comments?

this is another variant of the #9305 dedupe regression that's distinct from the ones already filed, so opening a separate issue for it.

cross-linking:

in particular I think this comment is the same issue, but not on the right issue....

discovered becauase we hit this in upgrading to vite@8.0.13 in nuxt/nuxt#35095

Metadata

Metadata

Type

Priority

None yet

Effort

None yet

Projects

Status
Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions