viteConfigure and optimize Vite for development, production builds, and library bundling.
Install via ClawdBot CLI:
clawdbot install ivangdavila/viteRequires:
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 SSRGenerated Mar 1, 2026
A development team building a single-page application (SPA) with React or Vue, requiring fast hot module replacement (HMR) for efficient development cycles and optimized production builds for deployment. They use environment variables for API configuration and proxy settings to connect to backend services during development.
A developer creating a reusable npm library or UI component package that needs to support both ESM and CommonJS formats for broad compatibility. They configure Vite in library mode to bundle dependencies appropriately and generate separate type definitions for TypeScript users.
A team developing a high-performance e-commerce frontend that requires code splitting for faster page loads, static asset optimization for images and fonts, and SSR configuration for improved SEO and initial render speed. They use path aliases to maintain clean import structures in a large codebase.
An organization building internal dashboards or admin panels that integrate with legacy APIs, using dev server proxy to handle CORS issues during development and environment variables for staging vs. production settings. They optimize dependencies to speed up dev server starts in a corporate environment.
Freelancers use Vite to quickly set up and deliver client projects like websites or small web apps, leveraging its fast dev server and easy configuration to reduce development time and offer competitive pricing. Revenue comes from project-based fees or hourly rates.
Startups or companies building subscription-based software products use Vite for its build optimization and library mode to create scalable frontends, reducing bundle sizes for better user experience and enabling faster feature iterations. Revenue is generated through monthly or annual subscriptions.
Digital agencies employ Vite in client engagements for custom web solutions, utilizing its SSR and proxy features to handle complex integrations and deliver high-performance sites. Revenue streams include retainer contracts, development services, and maintenance fees.
💬 Integration Tip
Ensure Node.js is installed and configure both vite.config.ts and tsconfig.json for path aliases to avoid TypeScript errors during development.
Create distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
Expert frontend design guidelines for creating beautiful, modern UIs. Use when building landing pages, dashboards, or any user interface.
Use when building UI with shadcn/ui components, Tailwind CSS layouts, form patterns with react-hook-form and zod, theming, dark mode, sidebar layouts, mobile navigation, or any shadcn component question.
Create distinctive, production-grade frontend interfaces with high design quality. Use this skill when building web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
Create distinctive, production-grade static sites with React, Tailwind CSS, and shadcn/ui — no mockups needed. Generates bold, memorable designs from plain text requirements with anti-AI-slop aesthetics, mobile-first responsive patterns, and single-file bundling. Use when building landing pages, marketing sites, portfolios, dashboards, or any static web UI. Supports both Vite (pure static) and Next.js (Vercel deploy) workflows.
AI skill for automated UI audits. Evaluate interfaces against proven UX principles for visual hierarchy, accessibility, cognitive load, navigation, and more. Based on Making UX Decisions by Tommy Geoco.