vite-development
Vite 8.0.10 build tooling — HMR, fast builds, plugins, and optimized production assets. Use when configuring Vite, setting up React/Vue projects with Vite, or optimizing frontend build performance.
- License 许可
- MIT
- 最近更新
- 2026-11-15
- Stars
- ★ 6
- Forks
- 0
01 前言 Front Matter
- name
- vite-development
- tags
- [ "vite", "development", "testing", "quality", "automation" ]
- version
- 2.0
- description
- Vite 8.0.10 build tooling — HMR, fast builds, plugins, and optimized production assets. Use when configuring Vite, setting up React/Vue projects with Vite, or optimizing frontend build performance.
- last_updated
- 1788825600000
02 资源文件 2
- 参考文档CHANGELOG.md6.8 KB
- 许可证LICENSE.txt1.0 KB
03 SKILL.md 正文
Vite Development
Optimized for Vite 8+, React 19+, TypeScript 5.5+, Vitest 2+, and modern ESM-first frontend builds.
Expert guidance for using Vite 8.0.10 as the build tool for React and other web applications with modern frontend development patterns. Documentation grounded in the official Vite docs at https://vite.dev/.
- Leverage native parallel subagent dispatch and 200k+ context windows where available.
Component Review Rubric Reference
Apply the shared Component Review Rubric before approving Vite components, then run the Vite-specific checks below.
<!-- MCP:START -->
<!-- PORTABILITY:START -->
Cross-Client Portability
This skill is written to stay usable across GitHub Copilot, Claude Code, and Codex.
- GitHub Copilot: keep the folder in a Copilot-visible skill path or wrap the workflow in project instructions when folder discovery is unavailable.
- Claude Code: keep the folder in a local skills directory or a compatible plugin source.
- Codex: install or sync the folder into
$CODEX_HOME/skills/vite-developmentand restart Codex after major changes.
<!-- PORTABILITY:END -->
MCP Availability And Fallback
Preferred MCP Server: None required
- Fallback prompt: "Use the Vite Development skill without MCP. Rely on its local instructions, bundled resources, standard shell or editor tools, and direct verification. Show the evidence used before concluding."
- Do not claim an MCP operation was used when the active host does not expose it.
- Treat local files, tests, rendered outputs, logs, or screenshots as the fallback evidence path.
<!-- MCP:END -->
Anti-Patterns
- Hard-coding environment-specific URLs: Builds become fragile as soon as the app moves between local, staging, and production.
- Treating plugin order as incidental: Vite plugins often transform the same files, so ordering bugs are easy to create.
- Assuming fast HMR guarantees good production output: Bundle quality and runtime behavior still need explicit review.
Verification Protocol
Before claiming "skill applied successfully":
- Pass/fail: The Vite Development guidance is tied to a concrete route, component, screen, or design artifact.
- Pass/fail: Component states cover loading, empty, error, success, and responsive breakpoints where applicable.
- Pass/fail: Accessibility, visual hierarchy, and interaction behavior are reviewed against the shared component rubric.
- Pressure-test scenario: Review the component on a narrow mobile viewport, keyboard-only path, and slow-loading state.
- Success metric: Zero generic UI approval; every approval cites rendered behavior or source evidence.
Before and After Example
// Before
export default {
server: { proxy: { '/api': 'http://localhost:3000' } },
};
// After
import { defineConfig, loadEnv } from 'vite';
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd(), '');
return {
server: {
proxy: {
'/api': {
target: env.VITE_API_BASE_URL,
changeOrigin: true,
},
},
},
};
});
Makes the proxy configuration mode-aware and driven by typed environment input instead of hard-coded URLs.
Activation Conditions
Use symptom -> action triggers: when one matches, apply this skill and verify with the protocol below.
Project Setup & Configuration:
- Initializing new Vite projects
- Configuring
vite.config.jswith plugins - Setting up development server with custom options
- Configuring build optimization and bundling
Performance & Optimization:
- Optimizing bundle size and code splitting
- Configuring lazy loading and dynamic imports
- Setting up asset optimization (images, CSS)
- Enabling CSS code splitting and module resolution
Development Experience:
- Configuring Hot Module Replacement (HMR)
- Setting up proxy for API calls in dev
- Environment variable handling
- Source map configuration
Plugin Ecosystem:
- Using official Vite plugins (React, Vue)
- Community plugins for specific needs
- Writing custom Vite plugins
- Configuring plugin options and hooks
Part 1: Project Configuration
Basic Vite Config
// vite.config.js
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
export default defineConfig({
plugins: [react()],
server: {
port: 5173,
open: true,
},
build: {
outDir: 'dist',
sourcemap: true,
rollupOptions: {
output: {
manualChunks: {
'react-vendor': ['react', 'react-dom'],
'api-client': ['./src/api/client'],
},
},
},
},
});
Environment-Specific Config
// vite.config.js
import { defineConfig, loadEnv } from 'vite';
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd());
return {
base: mode === 'production' ? '/app-base-path/' : '/',
server: {
proxy: {
'/api': {
target: env.VITE_API_URL || 'http://localhost:8080',
changeOrigin: true,
},
},
},
define: {
__APP_VERSION__: JSON.stringify(process.env.npm_package_version),
},
};
});
Part 2: Build Optimization
Code Splitting
// vite.config.js
export default defineConfig({
build: {
rollupOptions: {
output: {
manualChunks(id) {
if (id.includes('node_modules')) {
// React and ReactDOM
if (id.includes('react') || id.includes('react-dom')) {
return 'react-vendor';
}
// Other large libraries
if (id.includes('axios')) {
return 'api-lib';
}
return 'vendor';
}
},
},
},
},
});
Lazy Loading Routes
// Lazy loading route components
const RecipeDetail = lazy(() => import('./pages/RecipeDetail'));
const RecipeList = lazy(() => import('./pages/RecipeList'));
function App() {
return (
<Suspense fallback={<Loading />}>
<Routes>
<Route path="/recipes/:id" element={<RecipeDetail />} />
<Route path="/recipes" element={<RecipeList />} />
</Routes>
</Suspense>
);
}
Part 3: Development Server
Proxy Configuration
// vite.config.js
export default defineConfig({
server: {
proxy: {
'/api': {
target: 'http://localhost:8080',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, ''),
},
'/auth': {
target: 'http://localhost:8080',
changeOrigin: true,
},
},
},
});
HMR Configuration
// vite.config.js
export default defineConfig({
server: {
hmr: {
overlay: true,
},
watch: {
usePolling: true,
interval: 100,
},
},
});
Part 4: Assets and Plugins
Image Optimization
// vite.config.js
import { defineConfig } from 'vite';
import viteImagemin from 'vite-plugin-imagemin';
export default defineConfig({
plugins: [
viteImagemin({
gifsicle: { optimizationLevel: 7 },
optipng: { optimizationLevel: 7 },
mozjpeg: { quality: 80 },
pngquant: { quality: [0.65, 0.9], speed: 4 },
svgo: {
plugins: [
{
name: 'removeViewBox',
active: false,
},
],
},
}),
],
});
Vite Development Best Practices
Configuration
- [ ] Use
defineConfigfor type-safe configuration - [ ] Separate dev and production concerns
- [ ] Enable sourcemaps for debugging
- [ ] Configure proper base path for deployment
- [ ] Set up proxy for API during development
Build Optimization
- [ ] Implement code splitting for vendors
- [ ] Use lazy loading for heavy routes/components
- [ ] Configure manual chunks for better caching
- [ ] Optimize assets (images, fonts)
- [ ] Enable minification for production builds
Performance
- [ ] Monitor bundle size with Vite bundle analyzer
- [ ] Use tree-shaking to remove unused code
- [ ] Configure dynamic imports for better time-to-interactive
- [ ] Enable CSS code splitting for faster page loads
- [ ] Use compression middleware for production
Development
- [ ] Configure HMR for faster iteration
- [ ] Set up environment variables for different environments
- [ ] Use proxy for local API development
- [ ] Enable source maps for better debugging
- [ ] Configure clear port and open options
Common Pitfalls
- Hard-coding environment-specific URLs: Builds become fragile as soon as the app moves between local, staging, and production.
- Treating plugin order as incidental: Vite plugins can transform the same files, so ordering bugs are easy to create.
- Ignoring bundle inspection: Fast local HMR does not guarantee the production output is well-shaped.
Modern Component and Testing Examples
Server Components
export async function OrdersPanel() {
const orders = await getOrders();
return <OrdersTable orders={orders} />;
}
Error Boundaries
import { ErrorBoundary } from 'react-error-boundary';
<ErrorBoundary fallbackRender={() => <p>Could not load dashboard.</p>}>
<Dashboard />
</ErrorBoundary>
Accessibility Testing Tools
import { axe } from 'jest-axe';
test('dialog passes axe checks', async () => {
const { container } = render(<AccountDialog open />);
expect(await axe(container)).toHaveNoViolations();
});
References & Resources
Documentation
- Vite 2026 Config Reference — Comprehensive Vite configuration guide
- Vite Official Excerpts - HMR Config — Hot Module Replacement configuration
Examples
- Vite Config Examples — Example Vite configurations for different use cases
Scripts
- Vite Plugin Template — Template for creating custom Vite plugins
Official Documentation
Related Skills
- javascript-development: Use it when the workflow also needs modern JavaScript and TypeScript application code.
- react-development: Use it when the workflow also needs React component architecture and client or server boundaries.
- web-testing: Use it when the workflow also needs browser and end-to-end testing evidence.
- frontend-design: Use it when the workflow also needs UI composition and front-end design direction.
04 同仓库更多 Skills
serpmaven
Scrape Google search results (SERP) to JSON with SERP Maven (serpmaven) - a real Chrome browser on a residential proxy with sticky sessions. Run it as a CLI, a Python library, a local HTTP search API (`serve`), an MCP server or a Docker image; set the proxy login, workers, pages and cost tracking. Use when the user wants Google results, rank tracking, a self-hosted SERP API, or live Google search for an AI agent.
revnu-landing-page-audit
Find out why a landing page isn't turning visitors into signups, demos or sales. Audits one page against what the ad, post or search that sends people there promised, then checks the first screen, proof, call to action, friction and mobile. Returns at most 7 prioritized fixes, plus what is fine and what could not be checked; rewrites specific lines and fixes the page in the repo when asked. Never promises a conversion lift. Works without a Revnu account. Use when the user says or asks: "audit my landing page", "why isn't this page converting", "review my homepage", "my ads get clicks but no signups", "people bounce from the pricing page", "CRO review", "improve conversion rate", "is my hero section clear", "roast my landing page", "rewrite my headline", "what's wrong with this page", "landing page feedback", "make the signup page convert better". Not for SEO or AI-search audits, page speed engineering on its own, or building a new page from scratch.
revnu-growth-context
Write down once who buys, what they're stuck on, what it costs, what proof you have and what you've already tried, so every growth task starts from facts instead of a questionnaire. Creates or updates .agents/revnu-growth.md from the repo, the live site and the user, and imports an existing product-marketing.md. Use when the user says "set up our marketing context", "who is our ideal customer", "write our ICP", "describe the product for marketing", "positioning doc", "what's our brand voice", "remember this about our customers", "log what we tried", "what have we learned from marketing", "we changed pricing, update the context", "update our growth notes", "summarize the business for the agent", "import my product-marketing.md", "start a growth doc", or before a first marketing, SEO, outreach or launch task when no context file exists. Works without a Revnu account.
revnu-get-listed
Get onto the third-party pages AI answers and search cite when buyers ask for the best tool in your category: "best X" roundups, directories, review sites, GitHub awesome lists, community threads and comparison pages. Finds which ones are cited, ranks them by fit and effort, and drafts each submission, PR or pitch by the target's own rules. Use when the user says "get us listed", "which directories should we submit to", "how do we get into best-of lists", "why does ChatGPT recommend competitors and not us", "get mentioned in AI answers", "submit to awesome lists", "get on G2", "where are our competitors listed", "pitch listicle authors", "find backlink opportunities", "launch directories", "get into roundups", "Product Hunt alternatives", "where should we be listed", "get cited by Perplexity". Never submits, pays or posts without a yes. Works without a Revnu account.
revnu-ai-readiness-audit
Audit whether your website gives ChatGPT, Perplexity, Claude, Gemini and Google's AI Overviews something worth quoting, and fix the pages that don't. Use when the user says or asks "is my site ready for AI search", "audit my site for AI answers", "AEO audit", "GEO audit", "why doesn't ChatGPT quote our pricing", "make our pages citable by AI", "do I need llms.txt", "does schema help with ChatGPT", "check our structured data", "is our content visible without JavaScript", "AI SEO audit", "optimize our homepage for AI answers", "LLM SEO check", "why does AI get our product wrong", "fix our site for AI Overviews". Checks fetchability and indexability, answers in the raw HTML, entity facts, schema (including JS-injected markup), headings, dates and llms.txt, then gives at most 10 prioritised fixes and edits the repo when asked. Works without a Revnu account.
proxy-troubleshooting
Diagnose residential proxy failures, with NodeMaven's gateway as the reference - 407 with correct credentials, 406, 410, 500, a connection that hangs, ERR_TUNNEL_CONNECTION_FAILED in a browser, Playwright or Puppeteer ignoring proxy credentials, a sticky session that changes IP, geo-targeting that is silently ignored, passwords with special characters, and unexpected traffic from headless Chrome. Use when a proxy connection fails, returns the wrong location, or costs more traffic than expected.