بنقرة واحدة
vite
Use for Vite config, plugins, SSR, or Vite 8/Rolldown migration. Not for Vitest testing.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Use for Vite config, plugins, SSR, or Vite 8/Rolldown migration. Not for Vitest testing.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Use when implementing real-time DSP algorithms, audio thread architecture, or offline spectral analysis in C++/Rust. Covers filters, STFT pipelines, lock-free concurrency, and RT safety. Not for JUCE plugin lifecycle wiring or ffmpeg.
Use for real-time audio code safety, determinism, and numeric hygiene. Required foundation for DSP, audio analysis, audio systems, and JUCE work. Not for game-audio middleware or ffmpeg/video tasks.
Use when programmatically processing video/audio with libffmpeg C API. Not for command-line ffmpeg operations.
Use for JUCE audio apps/plugins: AudioProcessor lifecycle, VST3/AU targets, parameter systems, and thread separation. Requires audio-engineering-principles. Not for game-audio middleware or non-JUCE frameworks.
Use when writing, reviewing, or refactoring C++ code — covers workflow, essential patterns, and pre-commit checklist for modern C++17/20.
Use when writing or fixing C++ tests, configuring GoogleTest/CTest, or adding coverage/sanitizers.
| name | vite |
| description | Use for Vite config, plugins, SSR, or Vite 8/Rolldown migration. Not for Vitest testing. |
Vite 6+ frontend build tool — native ESM dev server + optimized production builds.
vite.config.ts with defineConfig. Always use TypeScript + ESM.vite starts dev server with instant HMRvite build for production, vite preview to test output locallydist/, set base option for non-root paths (e.g. GitHub Pages)import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
export default defineConfig({
plugins: [react()],
resolve: { alias: { '@': '/src' } },
server: {
port: 3000,
proxy: { '/api': 'http://localhost:8080' },
},
build: {
target: 'esnext',
outDir: 'dist',
},
})
Use defineConfig with a function for environment-conditional config:
export default defineConfig(({ command, mode }) => ({
plugins: [react()],
define: {
__DEV__: command === 'serve',
},
}))
Glob imports — dynamically load matching modules:
const modules = import.meta.glob('./modules/*.ts')
// eager: true loads all immediately instead of lazy
const eager = import.meta.glob('./locale/*.json', { eager: true })
Asset queries — import assets with transform hints:
import url from './img.png?url' // resolves to public URL string
import raw from './shader.glsl?raw' // resolves to file contents as string
import worker from './worker.ts?worker' // wraps as Web Worker
Env variables — only VITE_-prefixed vars are exposed to client code:
// .env
VITE_API_URL=https://api.example.com
SECRET_KEY=do-not-expose // NOT accessible in client
// in source
const url = import.meta.env.VITE_API_URL
CSS Modules — auto-enabled for .module.css files:
import styles from './app.module.css'
// styles.container → scoped class name
Vite plugins extend Rollup's plugin interface with additional Vite-specific hooks:
import type { Plugin } from 'vite'
function myPlugin(): Plugin {
return {
name: 'my-plugin',
// Vite hook: runs before Rollup
configResolved(config) {
console.log('resolved base:', config.base)
},
// Rollup hook: transform source files
transform(code, id) {
if (!id.endsWith('.custom')) return
return { code: transformCustom(code), map: null }
},
}
}
Plugin ordering: enforce: 'pre' runs before framework plugins, enforce: 'post' runs after.
vite build --ssr src/entry-server.ts # build server bundle
vite build # build client bundle separately
In dev, use server.ssrLoadModule to load modules through Vite's pipeline:
const { render } = await viteDevServer.ssrLoadModule('/src/entry-server.ts')
@vitejs/plugin-vue — Vue 3 SFC support@vitejs/plugin-react — React with Babel/Oxc (Vite 8+)@vitejs/plugin-react-swc — React with SWC (faster transforms)@vitejs/plugin-legacy — transpile for older browsers with @babel/preset-envprocess.env does not work in client code — use import.meta.env insteadVITE_ prefix on env vars — they will be undefined in the browser with no warningoptimizeDeps.include so Vite pre-bundles them as ESMimport.meta.hot.accept() or have an ancestor that does; otherwise Vite does a full reload{ eager: false } (the default) add lazy dynamic imports; with eager: true they all land in the initial bundle