reference (maintainer)
Yeah, this is a behavior change that is expected. If the value of the import is not used, Vite can (and ideally should) remove the imported file.
Vite 7 and Vite 8 both transforms with `/* #__PURE__ */`, but it seems there's a slightly different behavior in Rollup and Rolldown. Rollup does not seem to remove pure calls before scanning the imports in the file ([REPL](https://rollupjs.org/repl/?version=4.59.0&shareable=eyJleGFtcGxlIjpudWxsLCJtb2R1bGVzIjpbeyJjb2RlIjoiLyogI19fUFVSRV9fICovIE9iamVjdC5hc3NpZ24oe1xuICBzdWI6ICgpID0-IGltcG9ydChcIi4vc3ViLmpzXCIpXG59KSIsImlzRW50cnkiOnRydWUsIm5hbWUiOiJtYWluLmpzIn1dLCJvcHRpb25zIjp7fX0=), the "cannot resolve" error happens). On the other hand, Rolldown seems to remove pure calls ([REPL](https://repl.rolldown.rs/#eNo9jDELwjAQRv/KcS5pKcke0M1ZEdwCIS1RUuwpvatLyH/3XDp88L03vIoP9BWXVMjO/L+EfscBJyXXwyHG6/12jhF6B5dxzpPYxFyeZGogAN5GD6aD4wnK8nmvYgJap1YrAbtATae5jF7WLbc24FfLrySZBdsPk7QpFA==), the "cannot resolve" error does not happen).
The image assets are emitted when the corresponding file is loaded, so it's emitted with Rollup, but not emitted with Rolldown.
Currently, `eager: true` is working, but I don't think that will be guaranteed and may not work in the future. Fundamentally, we need a way to mark the files as an entry and watch them. `build.rolldownOptions.input` cannot watch globs and `import.meta.glob` cannot mark files as an entry.
A workaround I can think of is to write
```js
globalThis.somewhere = import.meta.glob([
'../images/**',
], { eager: true })
```
and then remove the assignment in `renderChunk`:
```js
function globUsedPlugin() {
return {
name: 'glob-used',
transform: {
filter: { code: 'import.meta.globUsed' },
handler(code) {
return { code: code.replaceAll('import.meta.globUsed', '_bke=import.meta.glob'), map: null }
}
},
renderChunk(code) {
return { code: code.replaceAll(/_bke\s=\s/g, m => ' '.repeat(m.length)), map: null }
}
}
}
```
closed book answer
I don't have reliable knowledge of Vite 8's `import.meta.glob` changes or how they affect the Laravel plugin — Vite 8 details aren't something I can confirm, and I'd rather not guess. The Laravel plugin (`laravel-vite-plugin`) historically relies on `import.meta.glob` for its `refresh` option (hot-reloading Blade/PHP files), so any change to glob semantics (e.g., eager/lazy defaults, query handling, or path resolution) could plausibly affect it, but I can't verify specifics.
Check the Vite 8 migration guide and the `laravel-vite-plugin` changelog/issues for the authoritative answer. If you can share the specific error or behavior change you're seeing, I can help reason through it.
hybrid + rerank answer
This is an expected behavior change in Vite 8, not a bug [3]. Vite 7 and Vite 8 both transform globs with `/* #__PURE__ */`, but Rollup doesn't remove pure calls before scanning imports (so the image assets get emitted), while Rolldown does remove them (so the assets are not emitted) [3]. Because the glob's value isn't used, Vite can and ideally should remove the imported file [3]. Using `eager: true` currently works, but that isn't guaranteed to keep working in the future [2]. A suggested workaround is assigning the glob to a global and stripping the assignment in `renderChunk` [2]:
```js
globalThis.somewhere = import.meta.glob(['../images/**'], { eager: true })
```
The thread notes that `build.rolldownOptions.input` cannot watch globs and `import.meta.glob` cannot mark files as an entry [2].