Skip to content

fix(migrate): move task cache settings in wrapped config callbacks - #2823

Open
wan9chi wants to merge 1 commit into
mainfrom
fix/migrate-task-cache-wrapped-config
Open

wan9chi wants to merge 1 commit into
mainfrom
fix/migrate-task-cache-wrapped-config

Conversation

@wan9chi

@wan9chi wan9chi commented Sep 25, 2026

Copy link
Copy Markdown
Member

The task cache migration from #2814 skipped run.tasks in configs written as a defineConfig callback with a type assertion, and printed no warning:

export default defineConfig(
  (conf) =>
    ({
      run: { tasks: { build: { command: 'tsc && vp build', input: [...], output: [...] } } },
    }) as UserConfig,
);

It looked through as directly 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 migrate reported success, then vp run failed with Failed to load task graph: Cache settings ... must be set under cache and asked the user to run vp migrate again.

The migration now looks through any mix of parentheses and type assertions around the config object and around its defineConfig callback.

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 to mergeConfig, 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):

Project Before After
vite-plus-ecosystem-ci/BlockNote 19 vite.config.ts files left unchanged without a warning; CI fails to load the task graph All 19 migrate; a second pass finds nothing left to move
vite-plus-ecosystem-ci/cloudflare-os No warning Warns about typed-storage's build task, which is passed to a helper. Tasks built in shared helper modules still need manual changes

The new unit tests fail against the previous logic and pass with this change.

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.
@github-actions

Copy link
Copy Markdown
Contributor

✅ Staging deployment successful!

Preview: https://viteplus-staging.void.app/
Commit: 3d19707

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

🚀 Deploying Preview to Cloudflare 🚀

Preview URL: https://fix-migrate-task-cache-wrapped-config-viteplus-dev.voidzero-docs.workers.dev (commit 3d19707)

This URL reflects your latest Preview deployment

Preview Deployments by commit

Status Deployment URL Commit Updated (UTC) See this deployment's details
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://7d894884-viteplus-dev.voidzero-docs.workers.dev 3d19707 2026-09-25T17:03:45.540Z Visit the dashboard ↗

@github-actions

Copy link
Copy Markdown
Contributor

CLI artifact sizes (3d19707)

Final release artifacts built by the canonical build-upstream and build-windows-cli actions.
The dist rows use the Linux build. The core total excludes .node files to match the release artifact.

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 +633 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%)

This branch has not been deployed

No deployments
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