|
| 1 | +<!--VITE PLUS START--> |
| 2 | + |
| 3 | +# Using Vite+, the Unified Toolchain for the Web |
| 4 | + |
| 5 | +This project is using Vite+, a modern toolchain built on top of Vite, Rolldown, Vitest, tsdown, Oxlint, and Oxfmt. Vite+ wraps these tools and package manager commands in a single, global CLI called `vite`. Vite+ is distinct from Vite, but it invokes Vite through `vite dev` and `vite build`. |
| 6 | + |
| 7 | +## Vite+ Workflow |
| 8 | + |
| 9 | +`vite` is a global binary that handles the full development lifecycle. Run `vite help` to print a list of commands and `vite <command> --help` for information about a specific command. |
| 10 | + |
| 11 | +### Vite+ Commands |
| 12 | + |
| 13 | +- dev - Run the development server |
| 14 | +- build - Build for production |
| 15 | +- lint - Lint code |
| 16 | +- test - Run tests |
| 17 | +- fmt - Format code |
| 18 | +- lib - Build library |
| 19 | +- migrate - Migrate an existing project to Vite+ |
| 20 | +- new - Create a new monorepo package (in-project) or a new project (global) |
| 21 | +- run - Run tasks from `package.json` scripts |
| 22 | + |
| 23 | +These commands map to their corresponding tools. For example, `vite dev --port 3000` runs Vite's dev server and works the same as Vite. `vite test` runs JavaScript tests through the bundled Vitest. The version of all tools can be checked using `vite --version`. This is useful when researching documentation, features, and bugs. |
| 24 | + |
| 25 | +### Package Manager Commands |
| 26 | + |
| 27 | +Vite+ automatically detects and wraps the underlying package manager such as pnpm, npm, or Yarn through the `packageManager` field in `package.json` or package manager-specific lockfiles. |
| 28 | + |
| 29 | +- install - Install all dependencies, or add packages if package names are provided |
| 30 | +- add - Add packages to dependencies |
| 31 | +- remove - Remove packages from dependencies |
| 32 | +- dlx - Execute a package binary without installing it as a dependency |
| 33 | +- info - View package information from the registry, including latest versions |
| 34 | +- link - Link packages for local development |
| 35 | +- outdated - Check for outdated packages |
| 36 | +- pm - Forward a command to the package manager |
| 37 | +- unlink - Unlink packages |
| 38 | +- update - Update packages to their latest versions |
| 39 | +- why - Show why a package is installed |
| 40 | + |
| 41 | +## Common Pitfalls |
| 42 | + |
| 43 | +- **Using the package manager directly:** Do not use pnpm, npm, or Yarn directly. Vite+ can handle all package manager operations. |
| 44 | +- **Always use Vite commands to run tools:** Don't attempt to run `vite vitest` or `vite oxlint`. They do not exist. Use `vite test` and `vite lint` instead. |
| 45 | +- **Running scripts:** Vite+ commands take precedence over `package.json` scripts. If there is a `test` script defined in `scripts` that conflicts with the built-in `vite test` command, run it using `vite run test`. |
| 46 | +- **Do not install Vitest, Oxlint, Oxfmt, or tsdown directly:** Vite+ wraps these tools. They must not be installed directly. You cannot upgrade these tools by installing their latest versions. Always use Vite+ commands. |
| 47 | +- **Import JavaScript modules from `vite-plus`:** Instead of importing from `vite` or `vitest`, all modules should be imported from the project's `vite-plus` dependency. For example, `import { defineConfig } from 'vite-plus';` or `import { expect, test, vi } from 'vite-plus/test';`. You must not install `vitest` to import test utilities. |
| 48 | +- **Type-Aware Linting:** There is no need to install `oxlint-tsgolint`, `vite lint --type-aware` works out of the box. |
| 49 | + |
| 50 | +## Review Checklist for Agents |
| 51 | + |
| 52 | +- [ ] Run `vite install` after pulling remote changes and before getting started. |
| 53 | +- [ ] Run `vite lint`, `vite fmt`, and `vite test` to validate changes. |
| 54 | +<!--VITE PLUS END--> |
0 commit comments