Skip to content

vp create mutates custom template vite.config.ts and creates duplicate config keys #1836

@blazeshomida

Description

@blazeshomida

Describe the bug

When creating a project from a custom GitHub template using vp create, the CLI appears to mutate the template's existing vite.config.ts instead of copying it as-is.

My original template has a complete vite.config.ts that imports local tooling config modules:

import { defineConfig } from "vite-plus";

import { fmt } from "./tooling/format";
import { lint } from "./tooling/lint";
import { getPlugins } from "./tooling/plugins";
import { tasks } from "./tooling/tasks";
import { test } from "./tooling/test";

export default defineConfig(({ mode }) => {
  return {
    server: { port: 3000 },
    resolve: { tsconfigPaths: true },
    plugins: getPlugins(mode),
    fmt,
    lint,
    test,
    run: { tasks },
  };
});

After running vp create, the generated project's vite.config.ts is changed to include additional inline fmt and lint config keys:

import { defineConfig } from "vite-plus";

import { fmt } from "./tooling/format";
import { lint } from "./tooling/lint";
import { getPlugins } from "./tooling/plugins";
import { tasks } from "./tooling/tasks";
import { test } from "./tooling/test";

export default defineConfig(({ mode }) => {
  return {
    fmt: {},
    lint: {
      jsPlugins: [{ name: "vite-plus", specifier: "vite-plus/oxlint-plugin" }],
      rules: { "vite-plus/prefer-vite-plus-imports": "error" },
      options: { typeAware: true, typeCheck: true },
    },
    server: { port: 3000 },
    resolve: { tsconfigPaths: true },
    plugins: getPlugins(mode),
    fmt,
    lint,
    test,
    run: { tasks },
  };
});

This creates duplicate fmt and lint keys in the returned config object.

Expected behavior: when a custom template already provides a vite.config.ts, vp create should preserve it exactly unless the template explicitly opts into config patching.

Actual behavior: vp create mutates the existing vite.config.ts and adds inline fmt / lint configuration, causing the generated project to differ from the source template.

Reproduction

https://github.com/blazeshomida/vp-react-start

Steps to reproduce

Run:

vp create github:blazeshomida/vp-react-start

Use these options:

  1. Target directory: example-app
  2. Package manager: pnpm
  3. Coding agent instruction files: none
  4. Editors: none
  5. Initialize a git repository: No
  6. Set up pre-commit hooks: No

Then inspect the generated vite.config.ts.

The generated config contains additional inline fmt and lint keys that were not present in the original template config.

System Info

$ vp env current
VITE+ - The Unified Toolchain for the Web

Environment:
  Version       24.16.0
  Source        engines.node
  Source Path   /Users/blazeshomida/Developer/projects/crypto-lab/package.json
  Project Root  /Users/blazeshomida/Developer/projects/crypto-lab

Tool Paths:
  node  /Users/blazeshomida/.vite-plus/js_runtime/node/24.16.0/bin/node
  npm   /Users/blazeshomida/.vite-plus/js_runtime/node/24.16.0/bin/npm
  npx   /Users/blazeshomida/.vite-plus/js_runtime/node/24.16.0/bin/npx

Package Manager:
  Name          pnpm
  Version       11.5.2
  Source        packageManager
  Source Path   /Users/blazeshomida/Developer/projects/crypto-lab/package.json
  Project Root  /Users/blazeshomida/Developer/projects/crypto-lab
  Bin Path      /Users/blazeshomida/.vite-plus/package_manager/pnpm/11.5.2/pnpm/bin/pnpm
$ vp --version
VITE+ - The Unified Toolchain for the Web

vp v0.1.24

Local vite-plus:
  vite-plus  v0.1.24

Tools:
  vite             v8.0.16
  rolldown         v1.0.3
  vitest           v4.1.8
  oxfmt            v0.52.0
  oxlint           v1.67.0
  oxlint-tsgolint  v0.23.0
  tsdown           v0.22.1

Environment:
  Package manager  pnpm v11.5.2
  Node.js          v24.16.0 (engines.node)

Used Package Manager

pnpm

Logs

$ vp create github:blazeshomida/vp-react-start
VITE+ - The Unified Toolchain for the Web

◇ Target directory:
  example-app

◇ Which package manager would you like to use?
  pnpm

◇ pnpm@11.6.0 installed

◇ Which coding agent instruction files should Vite+ create?
  none

◇ Which editors are you using?
    Writes editor config files to enable recommended extensions and Oxlint/Oxfmt integrations.
  none

◇ Initialize a git repository with an initial commit?
  No

◇ Set up pre-commit hooks to run formatting, linting, and type checking with auto-fixes?
  No

Generating project…

Running: pnpm dlx degit blazeshomida/vp-react-start example-app
Packages: +1
+
Progress: resolved 1, reused 1, downloaded 0, added 0, done
> cloned blazeshomida/vp-react-start#HEAD to example-app
◇ Dependencies installed

◇ Code formatted

◇ Scaffolded example-app
• Node 24.16.0  pnpm 11.6.0
✓ Dependencies installed in 3.8s
→ Next: cd example-app && vp run


Resulting `vite.config.ts` diff:


 export default defineConfig(({ mode }) => {
   return {
+    fmt: {},
+    lint: {
+      jsPlugins: [{ name: "vite-plus", specifier: "vite-plus/oxlint-plugin" }],
+      rules: { "vite-plus/prefer-vite-plus-imports": "error" },
+      options: { typeAware: true, typeCheck: true },
+    },
     server: { port: 3000 },
     resolve: { tsconfigPaths: true },
     plugins: getPlugins(mode),
     fmt,
     lint,
     test,
     run: { tasks },
   };
 });

Validations

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

Priority

None yet

Effort

None yet

Target date

None yet

Start date

None yet

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions