-
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Labels
p2-edge-caseBug, but has workaround or limited in scope (priority)Bug, but has workaround or limited in scope (priority)regressionThe issue only appears after a new releaseThe issue only appears after a new release
Description
Describe the bug
In development mode, if you cannot glob import from a folder that starts with a dot and is a sibling to script that is importing.
Specifically, if this is the directory structure:
And main.ts contains:
console.log(import.meta.glob("./foo/test.ts"));
console.log(import.meta.glob("./inner/.foo/test.ts"));
console.log(import.meta.glob("./.foo/test.ts"));Then all of them will work, except for the last glob import:
Failed to resolve import ".foo/test.ts" from "src/main.ts". Does the file exist?
It isn't affected by writing it as an absolute path, and is specific to development mode.
The bug was introduced in 7.1.0-beta.1 and has been present in all releases after, presumably because of #20528.
Reproduction
https://github.com/lassebomh/vite-glob-bug
Steps to reproduce
pnpm install && pnpm run dev and you should see the error in the browser.
System Info
System:
OS: Windows 11 10.0.26100
CPU: (16) x64 AMD Ryzen 9 6900HS with Radeon Graphics
Memory: 14.32 GB / 31.25 GB
Binaries:
Node: 20.12.2 - C:\Program Files\nodejs\node.EXE
npm: 10.5.2 - C:\Program Files\nodejs\npm.CMD
pnpm: 9.12.3 - C:\Program Files\nodejs\pnpm.CMD
Browsers:
Edge: Chromium (140.0.3485.54)
Internet Explorer: 11.0.26100.1882
npmPackages:
vite: 7.1.0-beta.1 => 7.1.0-beta.1Used 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.
Copilot
Metadata
Metadata
Assignees
Labels
p2-edge-caseBug, but has workaround or limited in scope (priority)Bug, but has workaround or limited in scope (priority)regressionThe issue only appears after a new releaseThe issue only appears after a new release