Skip to content

Cannot glob import from folders starting with dot #20788

Closed

Description

@lassebomh

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:

Image

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.1

Used Package Manager

pnpm

Logs

No response

Validations

Activity

  1. added theissue type on Sep 17, 2025
  2. added
    p2-edge-case
    regression
    on Sep 18, 2025
  3. locked and limited conversation to collaborators on Oct 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

p2-edge-caseregression

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions