Skip to content

Conversation

@8ctavio
Copy link
Contributor

@8ctavio 8ctavio commented Oct 20, 2025

Description

Fixes #20972.

In resolveSubpathImports, use a regular expression to match resolved relative paths' relative prefix since only checking a path starts with "." does not consider dot-prefixed directories.

The regex used was already defined in the same file:

const relativePrefixRE = /^\.\.?(?:[/\\]|$)/

@sapphi-red sapphi-red added the p2-edge-case Bug, but has workaround or limited in scope (priority) label Oct 21, 2025
@sapphi-red sapphi-red changed the title fix: match resolved subpath import path's relative prefix with regex (fix #20972) fix(resolve9: match resolved subpath import path's relative prefix with regex (fix #20972) Oct 21, 2025
@sapphi-red sapphi-red changed the title fix(resolve9: match resolved subpath import path's relative prefix with regex (fix #20972) fix(resolve): match resolved subpath import path's relative prefix with regex (fix #20972) Oct 21, 2025
@sapphi-red sapphi-red merged commit ff2d83e into vitejs:main Oct 21, 2025
19 checks passed
@8ctavio 8ctavio deleted the fix/resolve-subpath-imports branch October 27, 2025 18:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

p2-edge-case Bug, but has workaround or limited in scope (priority)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fail to resolve "#" (subpath) import whose mapped path includes dot-prefixed directory

3 participants