Skip to content

fix(core): prevent duplicate plugins in standalone mode - #422

Closed
webfansplz wants to merge 1 commit into
mainfrom
fix/standalone
Closed

fix(core): prevent duplicate plugins in standalone mode#422
webfansplz wants to merge 1 commit into
mainfrom
fix/standalone

Conversation

@webfansplz

Copy link
Copy Markdown
Member

Context

play:standalone resolves both the plugins declared in the playground Vite config and the plugins injected by the standalone launcher.

The previous deduplication only matched plugin names starting with vite:devtools. Devframe plugins and optional integrations use other names, so they could be initialized more than once, causing duplicate setup and RPC registrations.

Changes

  • Resolve the standalone DevTools() plugins once and deduplicate using their exact plugin names.
  • Preserve duplicate user plugins that are unrelated to the standalone injection.
  • Remove the playground’s redundant manual mounts for built-in Devframe plugins.

Copilot AI review requested due to automatic review settings July 15, 2026 16:46
@pkg-pr-new

pkg-pr-new Bot commented Jul 15, 2026

Copy link
Copy Markdown

Open in StackBlitz

@vitejs/devtools

npm i https://pkg.pr.new/vitejs/devtools/@vitejs/devtools@422

@vitejs/devtools-kit

npm i https://pkg.pr.new/vitejs/devtools/@vitejs/devtools-kit@422

@vitejs/devtools-oxc

npm i https://pkg.pr.new/vitejs/devtools/@vitejs/devtools-oxc@422

@vitejs/devtools-rolldown

npm i https://pkg.pr.new/vitejs/devtools/@vitejs/devtools-rolldown@422

@vitejs/devtools-vite

npm i https://pkg.pr.new/vitejs/devtools/@vitejs/devtools-vite@422

@vitejs/devtools-vitest

npm i https://pkg.pr.new/vitejs/devtools/@vitejs/devtools-vitest@422

commit: 1351d29

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes standalone-mode plugin initialization by deduplicating all plugins injected by DevTools() (not just those with the vite:devtools prefix), preventing duplicate setup/RPC registrations when the target project config also includes some of the same plugins.

Changes:

  • Resolve standalone DevTools() plugins once and dedupe resolved Vite plugins by exact injected plugin names.
  • Add unit tests for dedupeVitePlugins to ensure injected plugins are deduped while unrelated user duplicates are preserved.
  • Remove redundant manual Devframe plugin mounts from the core playground config (since DevTools() already mounts them).

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
packages/core/src/node/standalone.ts Resolves DevTools() once and dedupes injected plugins by exact names.
packages/core/src/node/tests/standalone.test.ts Adds coverage for the new name-based dedupe behavior.
packages/core/playground/vite.config.ts Removes redundant manual mounts for built-in Devframe plugins in the playground.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/core/src/node/standalone.ts
@webfansplz
webfansplz marked this pull request as draft July 15, 2026 17:11
@webfansplz

Copy link
Copy Markdown
Member Author

Waiting for #423 to be merged.

@antfu

antfu commented Jul 16, 2026

Copy link
Copy Markdown
Member

I wonder maybe we should have all launcher and devframe plugins wrapped into a single Vite plugin instead of polluting the Vite plugins pipeline

EDIT: I made it in 3fbc896

@webfansplz webfansplz closed this Jul 16, 2026
@webfansplz
webfansplz deleted the fix/standalone branch July 16, 2026 03:15
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.

3 participants