Skip to content

fix(cli): ignore pnpm node_modules/.modules.yaml as a task input - #3042

Closed
lifeiscontent wants to merge 1 commit into
voidzero-dev:mainfrom
lifeiscontent:fix/ignore-pnpm-modules-yaml
Closed

lifeiscontent wants to merge 1 commit into
voidzero-dev:mainfrom
lifeiscontent:fix/ignore-pnpm-modules-yaml

Conversation

@lifeiscontent

Copy link
Copy Markdown

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.

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.
@lifeiscontent

Copy link
Copy Markdown
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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant