-
-
Notifications
You must be signed in to change notification settings - Fork 7.1k
Description
Describe the bug
according to https://rollupjs.org/plugin-development/#this-getmoduleinfo
meta itself should not be overwritten, but it is ok to mutate its properties at any time to store meta information about a module. The advantage of doing this instead of keeping state in a plugin is that meta is persisted to and restored from the cache if it is used, e.g. when using watch mode from the CLI.
so returning meta
from a transform hook for an id one can expect it to be available for the remainder of build --watch
running.
but if you check out the 2 plugins in this vite config https://github.com/dominikg/getmoduleinfo-build-watch-repro/blob/main/vite.config.js and follow the reproduction steps, its not the case.
discovered in sveltejs/vite-plugin-svelte#1186
possibly related:
#18914 (during dev and same id instead of different id)
Reproduction
https://github.com/dominikg/getmoduleinfo-build-watch-repro
Steps to reproduce
- run
pnpm i && pnpm build --watch
- edit
src/counter.js
to add a new empty line and save - observe error on console
System Info
vite 7.1.1
Used 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.