[GH-ISSUE #12] vinext init generates vite.config.ts with duplicate rsc() plugin for App Router projects #4

Closed
opened 2026-05-06 12:36:24 +02:00 by BreizhHardware · 1 comment

Originally created by @southpolesteve on GitHub (Feb 24, 2026).
Original GitHub issue: https://github.com/cloudflare/vinext/issues/12

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
Originally created by @southpolesteve on GitHub (Feb 24, 2026). Original GitHub issue: https://github.com/cloudflare/vinext/issues/12 ## 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 ```bash 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 ```ts 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: ```ts 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
Author
Owner

@southpolesteve commented on GitHub (Feb 24, 2026):

Fixed in #15vinext init now generates a clean plugins: [vinext()] config for App Router projects without the duplicate rsc() call. Released in vinext@0.0.3.

<!-- gh-comment-id:3954129301 --> @southpolesteve commented on GitHub (Feb 24, 2026): Fixed in #15 — `vinext init` now generates a clean `plugins: [vinext()]` config for App Router projects without the duplicate `rsc()` call. Released in vinext@0.0.3.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/vinext#4
No description provided.