Configure and optimize Vite for development, production builds, and library bundling.
数据来源:ClawHub。 在 ClawSkills 查看
选择你使用的 Agent
方法一:命令行安装(推荐)
推荐(无需提前安装 clawhub)
npx clawhub@latest --dir ~/.claude/skills install vite或使用 clawhub CLI(需提前安装)
clawhub --dir ~/.claude/skills install vite⚠️ 需要 Node.js 18+,没有 Node?请使用下方方法二直接下载 ZIP。 安装 Node.js →
方法二:手动下载安装(无需 Node)
下载 ZIP,解压后将文件夹放到以下路径,重启 Agent 即可:
安装路径
~/.claude/skills/vite/💡解压后将文件夹放到上方路径,重启 Agent 即可生效
--- name: Vite description: Configure and optimize Vite for development, production builds, and library bundling. metadata: {"clawdbot":{"emoji":"⚡","requires":{"bins":["node"]},"os":["linux","darwin","win32"]}} ---
VITE_ prefixed vars are exposed to client code — DB_PASSWORD stays server-side, VITE_API_URL is bundledimport.meta.env.VITE_* not process.env — process.env is Node-only and undefined in browser.env.local overrides .env and is gitignored by default — use for local secretsimport.meta.env.MODE is development or production — use for conditional logic, not NODE_ENVoptimizeDeps.include for pre-bundlingrequire() doesn't work in Vite — use import or createRequire from module for dynamic requiresssr.noExternal or optimizeDeps.exclude and let Vite transform themimport pkg from 'pkg'; const { method } = pkgnode_modules/.vite to force rebuild after package changesoptimizeDeps.include for persistent cachenpm link) aren't pre-bundled — add to optimizeDeps.include explicitlyoptimizeDeps.force: true rebuilds every time — only for debugging, kills dev performancevite.config.ts AND tsconfig.json — Vite uses its own, TypeScript uses tsconfigpath.resolve(__dirname, './src') not relative paths — relative breaks depending on working directory@/ alias is not built-in — must configure manually unlike some frameworks// vite.config.ts
resolve: {
alias: { '@': path.resolve(__dirname, './src') }
}
changeOrigin: true rewrites Host header — required for most APIs that check originws: true — HTTP proxy doesn't forward WS by default/api proxies /api/users, /api/ only proxies /api//usersserver: {
proxy: {
'/api': {
target: 'http://localhost:3000',
changeOrigin: true,
rewrite: path => path.replace(/^\/api/, '')
}
}
}
public/ files served at root, not processed — use for favicons, robots.txt, files that need exact pathssrc/assets/ files are processed, hashed, can be imported — use for images, fonts referenced in codeimport logo from './logo.png' — hardcoded paths break after buildnew URL('./img.png', import.meta.url) for dynamic paths — template literals with variables don't workbuild.rollupOptions.output.manualChunks for code splitting — without it, one giant bundlerollup-plugin-visualizer — find unexpected large dependenciesbuild.target defaults to modern browsers — set 'es2015' for legacy support, but increases bundle sizebuild.cssCodeSplit: true (default) — each async chunk gets its own CSS filebuild.lib for npm packages — different config from app modeexternal for peer dependencies — don't bundle React/Vue into your librarytsc — Vite doesn't emit .d.ts filesformats: ['es', 'cjs'] — some consumers still need require()import.meta.hot.accept()server.hmr.overlay: false hides error overlay — useful for custom error handling but hides issuesssr.external for Node-only packages — prevents bundling node_modules in SSR buildssr.noExternal forces bundling — needed for packages with browser-specific imports?inline suffix or configure css.postcss for SSR安装 Vite 后,可以对 AI 说这些话来触发它
Help me get started with Vite
Explains what Vite does, walks through the setup, and runs a quick demo based on your current project
Use Vite to configure and optimize Vite for development, production builds, and...
Invokes Vite with the right parameters and returns the result directly in the conversation
What can I do with Vite in my developer & devops workflow?
Lists the top use cases for Vite, with example commands for each scenario
将技能文件夹放到 ~/.claude/skills/vite/ 目录(个人级,所有项目可用),或 .claude/skills/vite/(项目级)。重启 AI 客户端后,用 /vite 主动调用,或让 AI 根据上下文自动发现并使用。
Vite 支持 Claude、Cursor、OpenClaw,可与这些 AI 平台无缝集成,扩展其能力。
Vite 可免费安装使用。请查阅仓库了解许可证信息。
Configure and optimize Vite for development, production builds, and library bundling.
Vite 属于「Developer & DevOps」分类,该分类的技能帮助 AI 智能体在此领域执行专业任务。
Automate my developer & devops tasks using Vite
Identifies repetitive steps in your workflow and sets up Vite to handle them automatically