Skip to content

vinext init generates vite.config.ts with duplicate rsc() plugin for App Router projects #12

@southpolesteve

Description

@southpolesteve

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions