Skip to content

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

Draft
shulaoda wants to merge 1 commit into
mainfrom
06-26-test_dynamic-import_cover_object_rest_destructuring_of_dynamic_import
Draft

test(dynamic-import): cover object rest destructuring of dynamic import#22780
shulaoda wants to merge 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
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