Skip to content

配置 Vite+

🌐 Configuring Vite+

Vite+ 将项目配置集中在一个地方:vite.config.ts,允许你将许多顶层配置文件合并到一个文件中。你可以继续使用你的 Vite 配置,例如 serverbuild,并为工作流的其余部分添加 Vite+ 块:

🌐 Vite+ keeps project configuration in one place: vite.config.ts, allowing you to consolidate many top-level configuration files in a single file. You can keep using your Vite configuration such as server or build, and add Vite+ blocks for the rest of your workflow:

ts
import { defineConfig } from 'vite-plus';

export default defineConfig({
  server: {},
  build: {},
  preview: {},

  test: {},
  lint: {},
  fmt: {},
  run: {},
  pack: {},
  staged: {},
});

Vite+ 特定配置

🌐 Vite+ Specific Configuration

Vite+ 在基本的 Vite 配置上增加了以下内容:

🌐 Vite+ extends the basic Vite configuration with these additions:

  • lint 适用于 Oxlint
  • fmt 用于 Oxfmt
  • test 适用于 Vitest
  • run 用于 Vite 任务
  • pack 用于 tsdown
  • staged 用于暂存文件检查