fix(migrate): move task cache settings in wrapped config callbacks - #2823
Merged
Merged
Conversation
The task cache migration skipped `run.tasks` in configs such as
`defineConfig((env) => ({ ... }) as UserConfig)` without a warning. It
looked through `as` directly around the config object, but not through
the parentheses of an arrow body or around the callback itself. The
project then failed to load its task graph after a successful migration.
Look through any mix of parentheses and type assertions around the
config object and its `defineConfig` callback.
Warn about tasks in a top-level `vite.config.*` object that is not the
exported config, such as a variable the config refers to or an object
passed to `mergeConfig`, instead of skipping them silently.
Contributor
|
✅ Staging deployment successful! Preview: https://viteplus-staging.void.app/ |
🚀 Deploying Preview to Cloudflare 🚀Preview URL: https://fix-migrate-task-cache-wrapped-config-viteplus-dev.voidzero-docs.workers.dev (commit 7118b0d)This URL reflects your latest Preview deploymentPreview Deployments by commit
|
Contributor
CLI artifact sizes (
|
| Artifact | Format | Base | PR | Change |
|---|---|---|---|---|
packages/cli/dist |
Directory total | 2.35 MiB | 2.35 MiB | 0 B (0.00%) |
packages/core/dist |
Directory total | 3.96 MiB | 3.96 MiB | 0 B (0.00%) |
| Combined package dist | Directory total | 6.31 MiB | 6.31 MiB | 0 B (0.00%) |
vp (Linux x64) |
Binary | 11.29 MiB | 11.29 MiB | 0 B (0.00%) |
vp (Linux x64) |
gzip -9 | 4.88 MiB | 4.88 MiB | 0 B (0.00%) |
| NAPI (Linux x64) | Binary | 32.24 MiB | 32.25 MiB | +4.00 KiB (+0.01%) |
| NAPI (Linux x64) | gzip -9 | 12.78 MiB | 12.78 MiB | +394 B (+0.00%) |
vp (macOS ARM64) |
Binary | 8.41 MiB | 8.41 MiB | 0 B (0.00%) |
vp (macOS ARM64) |
gzip -9 | 4.26 MiB | 4.26 MiB | 0 B (0.00%) |
| NAPI (macOS ARM64) | Binary | 39.85 MiB | 39.85 MiB | 0 B (0.00%) |
| NAPI (macOS ARM64) | gzip -9 | 17.09 MiB | 17.09 MiB | +773 B (+0.00%) |
vp (Windows x64) |
Binary | 9.15 MiB | 9.15 MiB | 0 B (0.00%) |
vp (Windows x64) |
gzip -9 | 4.00 MiB | 4.00 MiB | +4 B (+0.00%) |
| NAPI (Windows x64) | Binary | 27.19 MiB | 27.19 MiB | +1.50 KiB (+0.01%) |
| NAPI (Windows x64) | gzip -9 | 10.89 MiB | 10.89 MiB | +628 B (+0.01%) |
| Trampoline (Windows x64) | Binary | 13.50 KiB | 13.50 KiB | 0 B (0.00%) |
| Trampoline (Windows x64) | gzip -9 | 7.08 KiB | 7.09 KiB | +3 B (+0.04%) |
| Installer (Windows x64) | Binary | 4.56 MiB | 4.56 MiB | 0 B (0.00%) |
| Installer (Windows x64) | gzip -9 | 2.13 MiB | 2.13 MiB | 0 B (0.00%) |
fengmk2
approved these changes
Sep 26, 2026
wan9chi
added a commit
that referenced
this pull request
Sep 26, 2026
Task cache settings now live under `cache`, and `vp migrate` moves existing task settings for you. `vp lint` and `vp fmt` run from a package directory now pick the same config as your editor, and piped `vp` output exits cleanly. ### Breaking Changes Task cache settings in `run.tasks` now go inside `cache` ([#2813](#2813), [#2814](#2814), [#2823](#2823), [vite-task#749](voidzero-dev/vite-task#749)), by @wan9chi. | Old (top level of a task) | New | | --- | --- | | `env` | `cache.env` | | `untrackedEnv` | `cache.untrackedEnv` | | `input` | `cache.input` | | `output` | `cache.output` | `cache: true` is the same as `cache: {}`. After upgrading, a task that still uses the old top-level fields fails with an error that points to `vp migrate`. Run `vp migrate` to move the fields in `vite.config.*` for the workspace root and every package. It warns about tasks in `vite.config.*` that it cannot rewrite safely. Tasks created in other modules, such as by a shared helper function, are not detected, so move their fields by hand; the error lists every task that still needs it. Projects whose tasks do not use these fields need no changes. See the [task cache migration rules](https://viteplus.dev/guide/migrate-rules#task-cache-configuration) and the [`cache` reference](https://viteplus.dev/config/run#cache). ### Highlights - `vp lint` and `vp fmt` run from a package directory now use the same config as Oxlint, Oxfmt, and the language server, so results match your editor. `vp check` still applies the workspace-root settings ([#2807](#2807)), by @fengmk2. - Global `vp` commands now exit cleanly when piped into a command that closes early, such as `vp --version | head -n 1`, instead of aborting with exit code 134 ([#2785](#2785), [#2793](#2793)), by @naokihaba. - Cached tasks on macOS no longer intermittently fail with `oils I/O error (main): No such process` ([vite-task#703](voidzero-dev/vite-task#703)), by @lifeiscontent. ### Features - The bundled tools update `vite@8.3.0` -> `vite@8.3.1`, `rolldown@1.2.9` -> `rolldown@1.2.11`, and `oxlint-tsgolint@7.0.2002` -> `oxlint-tsgolint@7.0.2003` ([#2805](#2805), [#2812](#2812)), by @voidzero-guard[bot]. ### Fixes & Enhancements - Async `defineConfig` callbacks now type-check lint and format options, such as `'warn'` rule severities, the same way as synchronous callbacks, so configs updated by `vp migrate` no longer fail with `TS2769` ([#2803](#2803)), by @TheAlexLichter. - `vp test --help` now lists the Vitest 5 options `--repeats`, `--injectCjsGlobals`, `--fsModuleCache`, `--fsModuleCachePath`, and `--sharedViteServer` ([#2809](#2809)), by @Marve10s. - On Windows, `vp run` now matches environment variable names regardless of letter case ([vite-task#747](voidzero-dev/vite-task#747)), by @wan9chi. ### Docs - The copy prompt dialog no longer nests scroll areas and shows clearer copy feedback ([#2794](#2794), [#2799](#2799)), by @liangmiQwQ and @Boshen. ### Chore - Snapshot tests share prepared packages and one Chromium process, run faster on every platform, and no longer read the live npm registry in the standalone npm fallback case ([#2771](#2771), [#2786](#2786), [#2797](#2797)), by @fengmk2 and @voidzero-guard[bot]. - The snapshot setup check links the local `vite-plus` package into its reference home instead of installing the version under release from npm, so it passes before that version is published ([#2819](#2819)), by @wan9chi. - The preview migration harness installs a project's committed dependencies before running `vp migrate`, so the Vitest 5 migration can read the original Vitest version ([#2822](#2822)), by @wan9chi. - The standalone install workflow loads the generated environment before running `vp env doctor` ([#2790](#2790)), by @naokihaba. ### Bundled Versions | Tool | Version | Source | | --- | --- | --- | | vite | `8.3.1` | [`39ddf7c`](vitejs/vite@39ddf7c) | | rolldown | `1.2.11` | [`8df4219`](rolldown/rolldown@8df4219) | | tsdown | `0.23.0` | [npm](https://npmx.dev/package/tsdown/v/0.23.0) | | vitest | `5.0.1` | [npm](https://npmx.dev/package/vitest/v/5.0.1) | | oxlint | `1.85.0` | [npm](https://npmx.dev/package/oxlint/v/1.85.0) | | oxlint-tsgolint | `7.0.2003` | [npm](https://npmx.dev/package/oxlint-tsgolint/v/7.0.2003) | | oxfmt | `0.70.0` | [npm](https://npmx.dev/package/oxfmt/v/0.70.0) | ### Upgrade ```bash vp upgrade ``` ### New Contributors @Marve10s **Full Changelog**: v1.0.0-rc.0...v1.0.0-rc.1 --- Merging this PR will trigger the release workflow. --------- Co-authored-by: voidzero-guard[bot] <278573678+voidzero-guard[bot]@users.noreply.github.com> Co-authored-by: wan9chi <me@wan9chi.com>
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.
The task cache migration from #2814 skipped
run.tasksin configs written as adefineConfigcallback with a type assertion, and printed no warning:It looked through
asdirectly around the config object, but not through the parentheses of the arrow body, nor through parentheses or assertions around the callback itself (defineConfig(((conf) => ({ ... })) as T)).vp migratereported success, thenvp runfailed withFailed to load task graph: Cache settings ... must be set under cacheand asked the user to runvp migrateagain.The migration now looks through any mix of parentheses and type assertions around the config object and around its
defineConfigcallback.It also warns about tasks in a top-level
vite.config.*object that is not the exported config, such as a variable the config refers to or an object passed tomergeConfig, instead of skipping them silently. Tasks created in other modules, for example by a shared helper, are still not detected; the migration rules page now says so.Found by the v1.0.0-rc.1 ecosystem smoke test (#2818):
vite-plus-ecosystem-ci/BlockNotevite.config.tsfiles left unchanged without a warning; CI fails to load the task graphvite-plus-ecosystem-ci/cloudflare-ostyped-storage'sbuildtask, which is passed to a helper. Tasks built in shared helper modules still need manual changesThe new unit tests fail against the previous logic and pass with this change.