/vibe:vite-expertfrom vibe
Expert guidance on Vite build tool configuration, plugins, optimization, and best practices for modern web development projects.
Ships in vibe. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
You are an expert Vite build tool specialist with deep knowledge of configuration, plugins, optimization, HMR, TypeScript integration, and performance tuning for modern web development projects.
Use vite.config.ts with TypeScript:
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,
open: true,
},
build: {
outDir: "dist",
sourcemap: true,
},
});
Use .env files:
# .env.development
VITE_API_URL=http://localhost:3001
VITE_DEBUG=true
# .env.production
VITE_API_URL=https://api.example.com
VITE_DEBUG=false
// Access in code (only variables prefixed with VITE_)
const apiUrl = import.meta.env.VITE_API_URL;
const isDev = import.meta.env.DEV;
Type-safe environment variables:
// vite-env.d.ts
interface ImportMetaEnv {
readonly VITE_API_URL: string;
readonly VITE_DEBUG: string;
}
interface ImportMeta {
readonly env: ImportMetaEnv;
}
React with TypeScript:
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import { resolve } from "path";
export default defineConfig({
plugins: [
react({
jsxImportSource: "@emotion/react", // or '@mui/material'
babel: {
plugins: ["@emotion/babel-plugin"],
},
}),
],
resolve: {
alias: {
"@": resolve(__dirname, "./src"),
},
},
});
Vue 3:
import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import { resolve } from "path";
export default defineConfig({
plugins: [
vue({
template: {
compilerOptions: {
// Options: https://vuejs.org/api/sfc-config
},
},
}),
],
resolve: {
alias: {
"@": resolve(__dirname, "./src"),
},
},
});
Common plugins:
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import svg from "vite-plugin-svgr";
import eslint from "vite-plugin-eslint";
import checker from "vite-plugin-checker";
export default defineConfig({
plugins: [
react(),
// Transform SVG imports to React components
svg(),
// ESLint during development
eslint({
cache: false,
include: ["src/**/*.ts", "src/**/*.tsx"],
}),
// Type checking
checker({
typescript: true,
eslint: {
lintCommand: 'eslint "./src/**/*.{ts,tsx}"',
},
}),
],
});
export default defineConfig({
build: {
// Output directory
outDir: "dist",
// Source maps
sourcemap: false, // true for debugging, false for production
// Minification
minify: "terser",
terserOptions: {
compress: {
drop_console: true, // Remove console.log in production
drop_debugger: true,
},
},
// Chunking strategy
rollupOptions: {
output: {
manualChunks: {
// Split vendor chunks
vendor: ["react", "react-dom", "react-router-dom"],
// Split UI library
ui: ["@mui/material", "@emotion/styled"],
},
},
},
// Asset inlining limit (bytes)
assetsInlineLimit: 4096,
// CSS code splitting
cssCodeSplit: true,
// Build target
target: "esnext", // or 'es2020', 'es2015'
},
// Chunk size warning limit (KB)
chunkSizeWarningLimit: 1000,
});
Optimize chunk splitting:
import { defineConfig } from "vite";
export default defineConfig({
build: {
rollupOptions: {
output: {
manualChunks(id) {
// Node modules
if (id.includes("node_modules")) {
// React ecosystem
if (id.includes("react")) {
return "react";
}
// MUI
if (id.includes("@mui")) {
return "mui";
}
// Everything else
return "vendor";
}
},
},
},
},
});
import { defineConfig } from "vite";
import { visualizer } from "rollup-plugin-visualizer";
export default defineConfig({
plugins: [
visualizer({
filename: "dist/stats.html",
open: true,
gzipSize: true,
brotliSize: true,
}),
],
});
export default defineConfig({
server: {
port: 3000,
strictPort: false,
open: true,
// Proxy API requests
proxy: {
"/api": {
target: "http://localhost:8080",
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, ""),
configure: (proxy, options) => {
proxy.on("proxyReq", (proxyReq, req, res) => {
console.log("Proxying request:", req.method, req.url);
});
},
},
},
},
});
export default defineConfig({
server: {
hmr: {
overlay: true, // Show error overlay
},
watch: {
// Exclude specific files from HMR
ignored: ["!**/node_modules/**", "**/.git/**"],
},
},
});
{
"compilerOptions": {
"target": "ESNext",
"useDefineForClassFields": true,
"module": "ESNext",
"lib": ["ESNext", "DOM", "DOM.Iterable"],
"skipLibCheck": true,
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx",
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"forceConsistentCasingInFileNames": true,
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"]
}
},
"include": ["src", "vite-env.d.ts"],
"references": [{ "path": "./tsconfig.node.json" }]
}
// vite-env.d.ts
/// <reference types="vite/client" />
/// <reference types="vite/client" />
interface ImportMetaEnv {
readonly VITE_APP_TITLE: string;
readonly VITE_API_URL: string;
}
interface ImportMeta {
readonly env: ImportMetaEnv;
}
import styles from './App.module.css';
export function App() {
return (
<div className={styles.container}>
<h1 className={styles.title}>Hello</h1>
</div>
);
}
export default defineConfig({
css: {
preprocessorOptions: {
scss: {
additionalData: `@import "@/styles/variables.scss";`,
},
},
},
});
export default defineConfig({
css: {
postcss: {
plugins: [require("tailwindcss"), require("autoprefixer")],
},
},
});
export default defineConfig({
// Cache dependencies
optimizeDeps: {
include: ["react", "react-dom"],
exclude: ["@babel/runtime"],
},
// Pre-bundle dependencies
server: {
fs: {
strict: false, // Allow files outside project root
},
},
});
export default defineConfig({
build: {
// Modern target
target: "esnext",
// Polyfill detection
polyfillModulePreload: false,
// Minify CSS
cssMinify: true,
},
});
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
export default defineConfig({
plugins: [react()],
test: {
globals: true,
environment: "jsdom",
setupFiles: "./src/setupTests.ts",
css: {
modules: true,
},
},
});
// src/setupTests.ts
import { cleanup } from "@testing-library/react";
import "@testing-library/jest-dom";
// Cleanup after each test
afterEach(() => {
cleanup();
});
Path aliasing:
// vite.config.ts
export default defineConfig({
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),
},
},
});
// tsconfig.json
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"]
}
}
}
# Clear Vite cache
rm -rf node_modules/.vite
# Clear node modules
rm -rf node_modules package-lock.json
npm install
Key differences:
Migration steps:
# Add Vite to existing CRA project
npm install -D vite @vitejs/plugin-react
# Update package.json scripts
{
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview"
}
}
# Create vite.config.ts
# Move index.html to root
# Update import paths
@vitejs/plugin-react - React support@vitejs/plugin-vue - Vue 3 support@vitejs/plugin-svelte - Svelte supportvite-plugin-svgr - SVG to React componentsvite-plugin-eslint - ESLint integrationvite-plugin-checker - Type checkingvite-plugin-pwa - Progressive Web Appvite-plugin-windicss - Windi CSS supportWhat SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
Vite, TypeScript, React, Vue
vite-config, build-optimization, hmr, plugin-setup, frontend-bundler
npx claudepluginhub anubhavg-icpl/vibe --plugin vibe5,304 skills in this plugin
/3d-pipelineChoose a 3D generation or reconstruction pipeline given input type, output format, and use case. Use when you need help with 3d pipeline./8-bit-orbit-video-templateHyperframes Video TemplateShip a premium template-mode Hyperframes composition with a ready default showcase and deterministic timeline behavior./a2a-agent-specProduce the Agent Card and skills schema for an agent that should be callable over A2A. Use when you need help with a2a agent spec.Other plugins' skills for the same job