Description
When vinext init detects an App Router project (i.e. an app/ directory), it generates a vite.config.ts that includes both vinext() and an explicit rsc() call in the plugins array. However, vinext() already auto-registers @vitejs/plugin-rsc when app/ is detected, causing a fatal error on startup.
Steps to Reproduce
npx create-next-app@latest my-app --yes
cd my-app
npx vinext init
# (after also installing vinext as a dep)
npx vinext dev
Generated Config
import vinext from "vinext";
import rsc from "@vitejs/plugin-rsc";
import { defineConfig } from "vite";
export default defineConfig({
plugins: [
vinext(),
rsc({
entries: {
rsc: "virtual:vinext-rsc-entry",
ssr: "virtual:vinext-app-ssr-entry",
client: "virtual:vinext-app-browser-entry",
},
}),
],
});
Actual Behavior
Error: [vinext] Duplicate @vitejs/plugin-rsc detected.
vinext auto-registers @vitejs/plugin-rsc when app/ is detected.
Your config also registers it manually, which doubles build time.
Fix: remove the explicit rsc() call from your plugins array.
Or: pass rsc: false to vinext() if you want to configure rsc() yourself.
Expected Behavior
For App Router projects, vinext init should generate a simpler config without the explicit rsc() call:
import vinext from "vinext";
import { defineConfig } from "vite";
export default defineConfig({
plugins: [vinext()],
});
The explicit rsc() config should only be generated for Pages Router projects or when the user opts out of auto-registration.
Environment
- vinext: 0.0.2
- Vite: 7.3.1
- Node: v24.3.0
Description
When
vinext initdetects an App Router project (i.e. anapp/directory), it generates avite.config.tsthat includes bothvinext()and an explicitrsc()call in the plugins array. However,vinext()already auto-registers@vitejs/plugin-rscwhenapp/is detected, causing a fatal error on startup.Steps to Reproduce
Generated Config
Actual Behavior
Expected Behavior
For App Router projects,
vinext initshould generate a simpler config without the explicitrsc()call:The explicit
rsc()config should only be generated for Pages Router projects or when the user opts out of auto-registration.Environment