Skip to content

Rewrite vite imports when vp create adds a package to a monorepo - #3282

Open
voidzero-bot[bot] wants to merge 1 commit into
mainfrom
triagebot/fix-3281
Open

voidzero-bot[bot] wants to merge 1 commit into
mainfrom
triagebot/fix-3281

Conversation

@voidzero-bot

@voidzero-bot voidzero-bot Bot commented Oct 29, 2026

Copy link
Copy Markdown

When vp create adds a third-party template to an existing Vite+ monorepo, it integrates the new package by calling rewriteMonorepoProject(..., deferLazyPluginWrapping = false). That function wrapped inline plugins with lazyPlugins but never ran rewriteAllImports, so defineConfig stayed imported from "vite". This caused vp check to fail with vite-plus/prefer-vite-plus-imports on the generated vite.config.ts.

The full rewriteMonorepo orchestrator already rewrites imports once for the whole workspace before deferring per-project plugin wrapping, and the standalone rewriteStandaloneProject rewrites imports before wrapping too. This change brings the direct rewriteMonorepoProject path in line with both of them.

  • Collect oxlintOwnerDirs before rewritePackageJson strips oxlint from the manifest.
  • When deferLazyPluginWrapping is false, run rewriteAllImports(projectPath, ...) before wrapLazyPluginsInViteConfig.

Added a regression test that drives a third-party-style vite.config.ts through rewriteMonorepoProject and asserts the vite import is rewritten to vite-plus while the plugin array is still wrapped.

Closes #3281

@cloudflare-workers-and-pages

Copy link
Copy Markdown

🚀 Deploying Preview to Cloudflare 🚀

Preview URL: https://triagebot-fix-3281-viteplus-dev.voidzero-docs.workers.dev (commit 4c24e51)

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://4298b01a-viteplus-dev.voidzero-docs.workers.dev 4c24e51 2026-10-29T21:23:33.809Z Visit the dashboard ↗

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

vp create doesn't rewrite vite imports when adding a third-party template to a monorepo

0 participants