名称: vite 描述: Vite配置、插件、优化、热模块替换(HMR)和构建定制。 允许工具: 读取、写入、编辑、Bash、Glob、Grep
Vite 技能
提供配置和优化Vite构建的专业协助。
能力
- 为各种框架配置Vite
- 创建和使用插件
- 优化构建
- 配置开发服务器
- 处理环境变量
配置示例
// vite.config.ts
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import path from 'path';
export default defineConfig({
plugins: [react()],
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),
},
},
server: {
port: 3000,
proxy: {
'/api': 'http://localhost:8080',
},
},
build: {
rollupOptions: {
output: {
manualChunks: {
vendor: ['react', 'react-dom'],
},
},
},
},
});
目标流程
- 前端构建设置
- 开发环境
- 构建优化