# vite 创建 React 项目

# 主要使用 @vitejs/plugin-react (opens new window)

# vite 创建 react 项目

使用 NPM:

$ npm init vite@latest
1

使用 Yarn:

$ yarn create vite
1

然后按照提示操作即可!

# 目录样子

# vite.config 中的配置

import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [react()],
});
1
2
3
4
5
6
7

至此创建一个基本的 react 项目