Repository navigation
fix(cli): ignore pnpm node_modules/.modules.yaml as a task input - #3042
Closed
lifeiscontent wants to merge 1 commit into
Closed
lifeiscontent wants to merge 1 commit into
lifeiscontent wants to merge 1 commit into
Conversation
Vite reads node_modules/.modules.yaml to find the pnpm virtual store when it resolves server options. Vite Task records that read as an input. pnpm rewrites the file on every install, because prunedAt changes, so every task misses its cache after a fresh install. Add a plugin that calls ignoreInput for the file in the config hook, before Vite reads it.
Author
|
Closing as a duplicate. vite-task#823 already fixes this in the cache fingerprint (leaves the noisy .modules.yaml fields out), and it ships in v1.2.0 (#3029). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Vite reads node_modules/.modules.yaml in the workspace root when it resolves server options. It uses the file to find the pnpm virtual store. This runs on every Vite config load, for example in vp test, vp build and vp pack.
Vite Task records that read as a task input. pnpm rewrites the file on every install, and only prunedAt changes. So after a fresh install every task misses its cache with "node_modules/.modules.yaml modified".
This change adds a small plugin to defineConfig. Its config hook calls ignoreInput for /node_modules/.modules.yaml before Vite reads the file. The read itself is in upstream Vite, so Vite+ ignores it the same way it ignores the vitest cache paths.
The new tests in define-config-plugins.spec.ts check that ignoreInput gets the file path, for a plain root and for a package root inside a workspace. Both tests fail when the ignoreInput call is removed. The plugin order assertions in index.spec.ts and define-config-plugins.spec.ts are updated.