fix: preserve Windows input paths with glob-special segment names - #23409
Open
gilangabdian wants to merge 1 commit into
Open
fix: preserve Windows input paths with glob-special segment names #23409gilangabdian wants to merge 1 commit into
gilangabdian wants to merge 1 commit into
Conversation
gilangabdian
force-pushed
the
fix/windows-input-paths-glob-characters
branch
from
September 1, 2026 05:00
5773a92 to
ff1259c
Compare
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
fixes #23383
On Windows, paths like
D:\desk\test\@src\whatever.htmlorD:\desk\test\[id]\page.htmlcrash Vite with
[UNRESOLVED_ENTRY].Root Cause
unescapeGlobCharacters()callsisDynamicPattern(value)on the raw input beforeany Windows check. On Windows,
\is the path separator — not an escape character —so
D:\test\[id]is misinterpreted as a glob pattern and throws.Fix
Add if
(isWindows)return value at the top ofunescapeGlobCharactersto skip all glob processing on Windows (backslash is a path separator, not an escape character).Refine
escapedGlobCharactersREto only match extglob modifiers (@,+,!) when followed by(, aligning withtinyglobby's extglob support.Add a
hasUnescapedGlobhelper that strips valid escapes before callingisDynamicPattern, so valid glob escapes on POSIX are handled correctly.Other PRs / Alternatives
There is an existing local branch chris/fix/windows-input-glob-unescape with a similar approach. However, it places
if (isWindows)afterisDynamicPattern(value), so paths with[or(segments (e.g.D:\test\[id]\page.html) still crash. Our fix places the guard at the very top, making it work for all glob-special characters.i also add a unit test to make sure this change is saved and doesn't break the existing codebase:
Added unit tests in
config.spec.ts(guarded byisWindowsso they only run on Windows CI) covering all affected path patterns:D:\desk\test\@src\whatever.htmlD:\desk\test\!notes\page.htmlD:\desk\test\+draft\page.htmlD:\desk\test\(draft)\page.html← would still fail with the other approachD:\desk\test\[id]\page.html← would still fail with the other approach