← Back to list

vite-advanced
by yonatangross
The Complete AI Development Toolkit for Claude Code — 159 skills, 34 agents, 20 commands, 144 hooks. Production-ready patterns for FastAPI, React 19, LangGraph, security, and testing.
⭐ 29🍴 4📅 Jan 23, 2026
SKILL.md
name: vite-advanced description: Advanced Vite 7+ patterns including Environment API, plugin development, SSR configuration, library mode, and build optimization. Use when customizing build pipelines, creating plugins, or configuring multi-environment builds. context: fork agent: frontend-ui-developer version: 1.0.0 tags: [vite, build, bundler, plugins, ssr, library-mode, environment-api, optimization] user-invocable: false
Vite Advanced Patterns
Advanced configuration for Vite 7+ including Environment API.
Vite 7 Environment API (Key 2026 Feature)
Multi-environment support is now first-class:
import { defineConfig } from 'vite'
export default defineConfig({
environments: {
// Browser client
client: {
build: {
outDir: 'dist/client',
manifest: true,
},
},
// Node.js SSR
ssr: {
build: {
outDir: 'dist/server',
target: 'node20',
},
},
// Edge runtime (Cloudflare, etc.)
edge: {
resolve: {
noExternal: true,
conditions: ['edge', 'worker'],
},
build: {
outDir: 'dist/edge',
},
},
},
})
Key Changes:
- Environments have their own module graph
- Plugins access
this.environmentin hooks createBuilderAPI for coordinated builds- Node.js 20.19+ or 22.12+ required
Plugin Development
Basic plugin structure:
export function myPlugin(): Plugin {
return {
name: 'my-plugin',
// Called once when config is resolved
configResolved(config) {
// Access resolved config
},
// Transform individual modules
transform(code, id) {
// this.environment available in Vite 7+
if (id.endsWith('.special')) {
return { code: transformCode(code) }
}
},
// Virtual modules
resolveId(id) {
if (id === 'virtual:my-module') {
return '\0virtual:my-module'
}
},
load(id) {
if (id === '\0virtual:my-module') {
return 'export const value = "generated"'
}
},
}
}
SSR Configuration
Development (middleware mode):
import { createServer } from 'vite'
const vite = await createServer({
server: { middlewareMode: true },
appType: 'custom',
})
app.use('*', async (req, res) => {
const url = req.originalUrl
let template = fs.readFileSync('index.html', 'utf-8')
template = await vite.transformIndexHtml(url, template)
const { render } = await vite.ssrLoadModule('/src/entry-server.tsx')
const html = template.replace('<!--outlet-->', await render(url))
res.send(html)
})
Production build scripts:
{
"scripts": {
"build:client": "vite build --outDir dist/client",
"build:server": "vite build --outDir dist/server --ssr src/entry-server.tsx"
}
}
Build Optimization
export default defineConfig({
build: {
target: 'baseline-widely-available', // Vite 7 default
sourcemap: false,
rollupOptions: {
output: {
manualChunks: {
vendor: ['react', 'react-dom'],
router: ['react-router-dom'],
},
},
},
},
})
Quick Reference
| Feature | Vite 7 Status |
|---|---|
| Environment API | Stable |
| ESM-only distribution | Default |
| Node.js requirement | 20.19+ or 22.12+ |
buildApp hook | New for plugins |
createBuilder | Multi-env builds |
Key Decisions
| Decision | Recommendation |
|---|---|
| Multi-env builds | Use Vite 7 Environment API |
| Plugin scope | Use this.environment for env-aware plugins |
| SSR | Middleware mode for dev, separate builds for prod |
| Chunks | Manual chunks for vendor/router separation |
Related Skills
biome-linting- Fast linting alongside Vitereact-server-components-framework- SSR integrationedge-computing-patterns- Edge environment builds
References
- Environment API - Multi-environment builds
- Plugin Development - Plugin hooks
- SSR Configuration - SSR setup
- Library Mode - Building packages
- Chunk Optimization - Build optimization
Score
Total Score
75/100
Based on repository quality metrics
✓SKILL.md
SKILL.mdファイルが含まれている
+20
✓LICENSE
ライセンスが設定されている
+10
✓説明文
100文字以上の説明がある
+10
○人気
GitHub Stars 100以上
0/15
✓最近の活動
1ヶ月以内に更新
+10
○フォーク
10回以上フォークされている
0/5
✓Issue管理
オープンIssueが50未満
+5
✓言語
プログラミング言語が設定されている
+5
✓タグ
1つ以上のタグが設定されている
+5
Reviews
💬
Reviews coming soon
