集成 Vite

Vite 是一个构建工具,旨在为现代 Web 项目提供更快、更精简的开发体验。

快速开始

要在 Turborepo 中快速开始使用 Vite,可以使用 the with-vite example

Terminal
npx create-turbo@latest -e with-vite

将 Vite 应用程序添加到现有仓库

使用 npm create vite 在包中设置新的 Vite 应用程序。从仓库的根目录运行:

Terminal
npm create vite@latest apps/my-app

与你的仓库集成

要将内部包添加到你的新应用程序中,使用你的包管理器将它们安装到应用程序中:

./apps/my-app/package.json
{
 "name": "my-app",
  "dependencies": {
+   "@repo/ui": "*"
  }
}

确保运行你的包管理器的安装命令。你还可能需要更新 package.json 中的 scripts 以适应你的仓库用例。

自定义任务

默认情况下,新应用程序将使用根 turbo.json 中定义的任务。如果你想为新应用程序配置不同的任务,请使用包配置