-
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Labels
feat: hmrp3-minor-bugAn edge case that only affects very specific usage (priority)An edge case that only affects very specific usage (priority)
Description
Describe the bug
import.meta.glob does not hmr correctly when the glob pattern is an array with exclusions, e.g.
import.meta.glob(["./modules/*.js", "!./modules/_a.js"], {
import: "default",
eager: true,
});The same behaviour can be observed when using rolldown-vite (not sure if a separate issue is necessary?)
Reproduction
https://github.com/MoritzLoewenstein/vite-import-glob-repro
Steps to reproduce
Issue 1: Adding a file which matches the glob import
npm run devnpm run addMod- page does not change
Expected Result: The following should be visible on the page
./modules/included_a.js: foo
./modules/included_b.js: foo
Actual Result: The page stays the same.
The page does display the correct result after manually saving main.js.
Issue 2: Deleting a file which matches the glob import
npm run devnpm run addMod- save main.js (see above why this is necessary)
npm run delMod
Expected Result: This should hmr the file that contains the glob import (main.js)
./modules/included_a.js: foo
Actual Result:
[vite] (client) Pre-transform error: Failed to load url /modules/included_b.js (resolved id: /home/myuser/documents/github/public/vite-import-glob-repro/modules/included_b.js) in /home/myuser/documents/github/public/vite-import-glob-repro/main.js. Does the file exist?
The page does display the correct result after manually saving main.js.
System Info
System:
OS: Linux 6.16 Manjaro Linux
CPU: (24) x64 AMD Ryzen 9 5900X 12-Core Processor
Memory: 19.10 GB / 31.23 GB
Container: Yes
Shell: 5.3.3 - /bin/bash
Binaries:
Node: 24.5.0 - ~/.volta/tools/image/node/24.5.0/bin/node
Yarn: 1.22.10 - ~/.volta/tools/image/yarn/1.22.10/bin/yarn
npm: 11.5.1 - ~/.volta/tools/image/node/24.5.0/bin/npm
pnpm: 10.17.0 - /usr/bin/pnpm
bun: 1.2.22 - ~/.bun/bin/bun
Watchman: 20250727.093445.0 - /usr/bin/watchman
Browsers:
Chromium: 140.0.7339.207
npmPackages:
vite: ^7.1.7 => 7.1.7Used Package Manager
npm
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.
Metadata
Metadata
Assignees
Labels
feat: hmrp3-minor-bugAn edge case that only affects very specific usage (priority)An edge case that only affects very specific usage (priority)