-
-
Notifications
You must be signed in to change notification settings - Fork 8k
import.meta.glob inconsistency between dev and build #22166
Copy link
Copy link
Open
Labels
bug: upstreamBug in a dependency of ViteBug in a dependency of ViteinconsistencyInconsistency between dev & buildInconsistency between dev & build
Description
Describe the bug
In vite v8 import.meta.glob behaves differently in dev and build for directories that contain parenthesis (which is used in SvelteKit for example).
In dev mode parenthesis must be escaped, in build mode they must not be escaped.
In this example (from the reproduction repo)
const escaped = import.meta.glob("./\\(dir\\)/*.js", { eager: true })
const unescaped = import.meta.glob("./(dir)/*.js", { eager: true })
escapedwill be populated only in dev modeunescapedwill be populated only in build mode
Reproduction
https://github.com/DominikRusso/vite-glob-paren-repro
Steps to reproduce
- run
pnpm install - run
pnpm devand visithttp://localhost:5173 - only
escapedwill be populated - run
pnpm buildfollowed bypnpm previewand visithttp://localhost:4173 - only
unescapedwill be populated
System Info
System:
OS: macOS 26.4
CPU: (10) arm64 Apple M4
Memory: 464.78 MB / 16.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 25.9.0 - /opt/homebrew/bin/node
npm: 11.12.1 - /opt/homebrew/bin/npm
pnpm: 10.33.0 - /opt/homebrew/bin/pnpm
Deno: 2.7.11 - /opt/homebrew/bin/deno
Browsers:
Chrome: 146.0.7680.178
Firefox: 148.0
Safari: 26.4
npmPackages:
vite: 8.0.5 => 8.0.5Used Package Manager
pnpm
Logs
No response
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to vuejs/core instead.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bug: upstreamBug in a dependency of ViteBug in a dependency of ViteinconsistencyInconsistency between dev & buildInconsistency between dev & build