You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(cli): load task and tool metadata without resolving Vite - #3187
Reading task or tool settings from vite.config.* currently runs Vite's full config-resolution pipeline. A plugin's config or configResolved hook can therefore fail a metadata read, and Vite resolves dev-server options that the metadata consumer never uses.
Issue #2845 traced this path to the read of pnpm's node_modules/.modules.yaml. Automatic task input tracking originally made changes to installation timestamps and machine-specific paths invalidate cached tasks. Current main already contains vite-task#850, which fingerprints only the manifest's existence. This change removes the unnecessary resolution path itself.
Use Vite's public loadConfigFromFile inside the existing metadata-resolution guard. Preserve config discovery, workspace traversal, the loaded config path, async/function configs, and the existing build / development evaluation defaults. Preserve NODE_ENV initialization, including Vite Task's tracked environment lookup. Return the user config instead of a fully resolved Vite config.
The public resolveConfig export and dev/build/preview paths retain full resolution. Metadata fields supplied by plugin hooks will no longer be populated on this path.
Validation
pnpm -F vite-plus build: passed, including JS/declarations and the native binding.
vp test run packages/cli: 90 files passed; 2,370 tests passed, one skipped.
pnpm test:unit: 113 files passed; 2,557 tests passed, one skipped.
vp check and pnpm tsgo: passed.
Eight new cases cover skipped plugin hooks, equal metadata across equivalent pnpm manifest states, async-config environment defaults, missing configs, workspace traversal, and full resolution after metadata loading.
The two central regressions fail with the original loader and pass with this change. Full-resolution controls still run plugin hooks and include each installation's virtual-store path in server.fs.allow.
Oxlint and Oxfmt need a separate Oxc change: their shared loader calls the public resolveConfig export directly and does not use this internal helper.
Written by an AI agent (Claude) on behalf of @jasonkuhrt.
@fengmk2 thanks. Resolving the conflicts showed that the conflict is about behavior, not just text, so I'm closing this PR instead of merging main into it.
#3249 (merged 2026-10-28) made metadata reads keep plugin apply, config and configResolved hooks. Its config_resolution_hooks snapshots check that vp staged and vp pack use the staged and pack config a plugin's config hook returns. This PR loads the config with loadConfigFromFile, which never runs plugin hooks (in Vite they run only in resolveConfig), so those snapshots would fail. Its own description already said that plugin-supplied metadata would no longer be filled in on this path.
The cache misses that motivated it (#2845) come from fingerprinting node_modules/.modules.yaml. vite-task#850 already changed that to fingerprint only whether the file exists, so this PR isn't needed for that fix.
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
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.
Summary
Reading task or tool settings from
vite.config.*currently runs Vite's full config-resolution pipeline. A plugin'sconfigorconfigResolvedhook can therefore fail a metadata read, and Vite resolves dev-server options that the metadata consumer never uses.Issue #2845 traced this path to the read of pnpm's
node_modules/.modules.yaml. Automatic task input tracking originally made changes to installation timestamps and machine-specific paths invalidate cached tasks. Current main already contains vite-task#850, which fingerprints only the manifest's existence. This change removes the unnecessary resolution path itself.Use Vite's public
loadConfigFromFileinside the existing metadata-resolution guard. Preserve config discovery, workspace traversal, the loaded config path, async/function configs, and the existingbuild/developmentevaluation defaults. PreserveNODE_ENVinitialization, including Vite Task's tracked environment lookup. Return the user config instead of a fully resolved Vite config.The public
resolveConfigexport and dev/build/preview paths retain full resolution. Metadata fields supplied by plugin hooks will no longer be populated on this path.Validation
pnpm -F vite-plus build: passed, including JS/declarations and the native binding.vp test run packages/cli: 90 files passed; 2,370 tests passed, one skipped.pnpm test:unit: 113 files passed; 2,557 tests passed, one skipped.vp checkandpnpm tsgo: passed.server.fs.allow.Oxlint and Oxfmt need a separate Oxc change: their shared loader calls the public
resolveConfigexport directly and does not use this internal helper.Refs #2845