Skip to content

[Bug]: builtin:vite-import-glob does not follow symbolic links during file scanning #8980

@jonathankli

Description

@jonathankli

Reproduction link or steps

Create a project with a symlinked directory:

project/
├── packages/
│   └── my-lib/
│       └── components/
│           ├── A.js
│           └── B.js
├── linked/
│   └── my-lib -> ../../packages/my-lib   (symlink)
└── src/
    └── entry.js

Use import.meta.glob with a wildcard pattern that traverses the symlink:

// src/entry.js
const mods = import.meta.glob('/linked/*/components/*.js', { eager: true })
console.log(Object.keys(mods))
  • vite dev → glob resolves correctly, finds both files
  • vite build → glob returns {}

The files are reachable through the symlink (ls linked/my-lib/components/ lists both files).

What is expected?

import.meta.glob should follow symlinks during build, matching the dev server behavior and the previous JS-based implementation (which used tinyglobby with followSymbolicLinks: true).

What is actually happening?

During build, Vite 8 delegates to rolldown's native builtin:vite-import-glob. This implementation does not follow symlinks, so glob patterns traversing symlinked directories return empty results.

System Info

OS: macOS 26.2 (arm64 Apple M3 Pro)
Node: 22.14.0
rolldown: 1.0.0-rc.12
vite: 8.0.3

Any additional comments?

Common in monorepos where package managers create symlinks for local packages (Composer path repos, npm link, workspaces). The native plugin should ideally respect resolve.preserveSymlinks or follow symlinks by default to match tinyglobby's behavior.

Metadata

Metadata

Type

Priority

None yet

Effort

None yet

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions