Skip to content

test(dynamic-import): cover object rest destructuring of dynamic import#22780

Merged
sapphi-red merged 1 commit into
mainfrom
06-26-test_dynamic-import_cover_object_rest_destructuring_of_dynamic_import
Jul 9, 2026
Merged

test(dynamic-import): cover object rest destructuring of dynamic import#22780
sapphi-red merged 1 commit into
mainfrom
06-26-test_dynamic-import_cover_object_rest_destructuring_of_dynamic_import

Conversation

@shulaoda

Copy link
Copy Markdown
Member

What this solves

Adds a regression test for object rest destructuring of a dynamic import. With the build-time __vitePreload rewrite, import('./m').then(({ a, ...rest }) => ...) dropped the sibling exports from rest (it was nested one level deeper, { rest: {...} }), silently producing wrong output. The underlying bug and fix are in rolldown: rolldown/rolldown#9976.

The new case in playground/dynamic-import imports a module with several named exports via object-rest destructuring and asserts that rest keeps its sibling keys. It fails against the buggy build output and passes once Vite picks up the fixed rolldown.

Notes for reviewers

The test exercises the build-mode __vitePreload path (the native viteBuildImportAnalysisPlugin from rolldown/experimental). It turns green after the rolldown fix (rolldown/rolldown#9976) is released and the rolldown dependency is bumped.

@shulaoda
shulaoda force-pushed the 06-26-test_dynamic-import_cover_object_rest_destructuring_of_dynamic_import branch from 6aae651 to d1592ad Compare June 26, 2026 06:36
@shulaoda shulaoda reopened this Jun 26, 2026
@shulaoda shulaoda reopened this Jun 27, 2026
@sapphi-red sapphi-red added p1-chore Doesn't change code behavior (priority) test labels Jun 30, 2026
@shulaoda
shulaoda marked this pull request as ready for review July 6, 2026 10:33
@shulaoda
shulaoda force-pushed the 06-26-test_dynamic-import_cover_object_rest_destructuring_of_dynamic_import branch from d1592ad to 506da9c Compare July 6, 2026 10:40
@sapphi-red
sapphi-red merged commit 0ba613f into main Jul 9, 2026
21 checks passed
@sapphi-red
sapphi-red deleted the 06-26-test_dynamic-import_cover_object_rest_destructuring_of_dynamic_import branch July 9, 2026 02:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

p1-chore Doesn't change code behavior (priority) test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants