Skip to Content

Vite

安装和配置 Vite。

创建项目

首先,使用以下命令创建一个新的 React 项目 vite

Tip

目前仅支持 Vite 的 React 模板

npm create vite@latest

添加 Canyon 和配置

npm install babel-plugin-istanbul @canyonjs/babel-plugin -D

配置 Babel 插件

vite.config.ts
import { defineConfig } from 'vite' import react from '@vitejs/plugin-react' // https://vite.dev/config/ export default defineConfig({ plugins: [react({ babel:{ plugins:["istanbul","canyon"] } })], })

完成了

继续查看首次获取覆盖率数据 - 验证