test(glob-import): cover array patterns with sibling dirs sharing a prefix#22281
Merged
Merged
Conversation
8ee73a1 to
6c1b939
Compare
bluwy
approved these changes
Apr 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
import.meta.glob([...])where the array entries target sibling directories whose names share a byte-level prefix but are distinct path segments (e.g.pattern1/andpattern2/).playground/glob-import/array-common-base/pattern{1,2}/*.js, wires up a newarray-common-base-resultblock inindex.html, and asserts the resolved modules inglob-import.spec.ts(runs in both serve and build modes).Why
During
vite build, arrayimport.meta.globpatterns are handled by rolldown's nativeviteImportGlobPlugin. Itsget_common_baseused a byte-wise longest common prefix to decide where to startwalkdir. For array entries like/array-common-base/pattern1/**/*.jsand/array-common-base/pattern2/**/*.js, that produced/array-common-base/pattern— a path that cuts in the middle of a segment and points to no real directory.walkdirthen found nothing and the bundled output wasObject.assign({}). Dev (vite dev) took a different code path and worked fine, so the regression only surfaced in production builds.rolldown/rolldown#9070 fixed
get_common_baseto always land on a path-segment boundary. This test pins that behavior on the Vite side so a future regression is caught by the playground e2e suite rather than by users.