mcpField
V
vite

vite

github.com/oakossDevelopment21132 installsUpdated 12w ago
Repository

About vite

Vite is a build tool for modern frontend projects, with a native ES module dev server and Rollup-based production builds. This skill collects guidance on configuration, plugins, assets, and SSR for frontend developers.

Key features

  1. 01Fast dev server startup
  2. 02Rollup-based production builds
  3. 03TypeScript, JSX, and CSS preprocessor support
  4. 04Plugin and virtual module hooks
  5. 05Library, multi-page, and SSR builds

Use cases

  1. 01Building single- or multi-page apps
  2. 02Configuring an SSR project
  3. 03Building and publishing a library
  4. 04Managing frontend packages in a monorepo

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/oakoss/agent-skills --skill vite

After installing, type/vitein Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

references/
build-optimization.md
configuration.md
css-and-assets.md
dev-server.md
environment-variables.md
library-mode.md
plugins.md
ssr-configuration.md

Details

From the project README

Vite

Overview

Vite is a next-generation frontend build tool that provides instant dev server start via native ES modules and optimized production builds via Rollup. It supports TypeScript, JSX, CSS preprocessors, and static assets out of the box with zero configuration.

When to use: Single-page apps, multi-page apps, library publishing, SSR applications, monorepo packages, any modern frontend project needing fast dev feedback and optimized builds.

When NOT to use: Legacy browsers requiring ES5 output without transpilation, projects locked to Webpack-specific loaders with no Vite equivalents, non-JavaScript build pipelines.

Quick Reference

PatternAPIKey Points
Config filedefineConfig({})Type-safe config with IDE support
Conditional configdefineConfig(({ command, mode }) => ({}))Different config per command/mode
Path aliasresolve.aliasMap @/ to src/
Dev proxyserver.proxyForward API requests to backend
HMR configserver.hmrWebSocket host/port/protocol
HTTPS devserver.httpsPass TLS cert/key options
Build targetbuild.targetES module target for output
Manual chunksbuild.rollupOptions.output.manualChunksControl code splitting
Library modebuild.libPublish ES/CJS/UMD packages
SSR buildbuild.ssr + ssr optionsServer-side rendering config
Env variablesimport.meta.env.VITE_*Client-exposed env vars
loadEnvloadEnv(mode, root, prefix)Load env vars in config
CSS modulescss.modulesScoped CSS class names
Preprocessorscss.preprocessorOptionsSass/Less/Stylus options
PostCSScss.postcssInline or external PostCSS config
Static assetsimport url from './img.png'Returns resolved public URL
Plugin{ name, transform, load }Hook-based plugin system
Virtual moduleresolveId + load hooksGenerate modules at build time
Multi-pagebuild.rollupOptions.inputMultiple HTML entry points

Common Mistakes

MistakeCorrect Pattern
Exposing secrets via VITE_ prefixOnly prefix client-safe vars with VITE_; use loadEnv in config for server-only secrets
Using process.env in client codeUse import.meta.env.VITE_* (Vite replaces at build time)
Modifying rollupOptions.input without resolve()Always use path.resolve() or import.meta.dirname for absolute paths
Not externalizing peer deps in library modeAdd React/Vue to rollupOptions.external to avoid bundling
Creating QueryClient-style singletons in SSREnsure per-request state in SSR to avoid cross-request leaks
Inline PostCSS config alongside postcss.config.jsUse one or the other; inline config disables config file search
Setting base without trailing slashbase should be /path/ with trailing slash or full URL
Using __dirname in ESM configUse import.meta.dirname (Node 21+) or fileURLToPath

Delegation

  • Plugin discovery: Use Explore agent
  • Build analysis: Use Task agent
  • Config review: Delegate to code-reviewer agent

If the vitest-testing skill is available, delegate test configuration and Vitest setup to it. If the tailwind skill is available, delegate Tailwind CSS configuration and utility patterns to it. If the react-patterns skill is available, delegate React component patterns and hooks to it. If the typescript-patterns skill is available, delegate TypeScript configuration and type patterns to it. If the pnpm-workspace skill is available, delegate monorepo workspace configuration to it.

References

Comments

Markdown supported