Vite Project Standard
Use when creating, configuring, reviewing, or debugging Vite-based frontend projects, vite.config.ts, env variables, dev server proxy, HMR, plugin ordering, library mode, dependenc…
Bovin Phang
@bovinphang
Install
$ openclaw skills install @bovinphang/fec-vite-project-standardVite Project Specifications
Design and review of Vite applications, component libraries, development servers, and build configurations.
Purpose
Standardize Vite configurations, security boundaries, and build performance to avoid common pitfalls of development environments and production builds.
Procedure
-
Identify the project type
- Application projects check
root,base,server.proxy,envPrefix,buildand framework plugins first. - Component library projects check
build.lib, type products, peer dependencies external and export entries first. - Monorepo additional checks for
server.fs.allow, path aliases and package dependency boundaries.
- Application projects check
-
Select plugin
- React gives priority to
@vitejs/plugin-react-swcby default; use@vitejs/plugin-reactonly when the Babel plug-in is required. - The Vue project uses
@vitejs/plugin-vue, and path aliases are given priority tovite-tsconfig-paths. - TypeScript projects must complete type checking via
tsc --noEmit, CI orvite-plugin-checker.
- React gives priority to
-
Manage environment variables
- Clients only read explicitly exposed prefixes, such as
VITE_. - The third parameter of
loadEnvuses an explicit prefix array and does not use an empty string to load all variables. - Keys, database addresses, and private tokens must stay on the server or build system and not enter the client bundle.
- Clients only read explicitly exposed prefixes, such as
-
Optimize development experience
- Use
vite --profileto locate plug-in, parsing or pre-built bottlenecks before slow start. - Use
optimizeDeps.includefor CJS/UMD dependencies to handle interop issues. - Large projects can use
server.warmup.clientFilesto warm up the core entrance.
- Use
-
Optimize production builds
- Run
vite buildbefore release and usevite previewto do local build smoke testing. - Prioritize manual subcontracting by using stable object forms to avoid splitting each dependency into independent small chunks.
- The production sourcemap is turned off by default; if uploaded to the error tracking platform, it will not be published with the site after uploading.
- Motion effects, 3D, charts, editors, maps, and audio and video processing libraries are prioritized for isolation through dynamic import or route-level unpacking.
- Check whether static resources go into the correct directory, have been hashed/cache, have placeholder URLs, or are too large uncompressed media.
- Run
Minimal Config
import { defineConfig, loadEnv } from "vite";
import react from "@vitejs/plugin-react-swc";
import tsconfigPaths from "vite-tsconfig-paths";
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd(), ["VITE_"]);
return {
plugins: [react(), tsconfigPaths()],
define: {
__PUBLIC_API_URL__: JSON.stringify(env.VITE_API_URL),
},
server: {
proxy: {
"/api": {
target: "http://localhost:8080",
changeOrigin: true,
},
},
},
};
});
Constraints
vite buildonly translates and packages, not type checking; CI must run typecheck separately.VITE_is not a security boundary; anyVITE_variable goes into the client package.- Do not set
envPrefix: "", do not useloadEnv(mode, root, "")and thendefineat will. - Legacy plugins are not introduced by default; only enable them when needed for real user data.
- Don't use
vite previewas a production server. - Component libraries must externalize peer dependencies and produce
.d.tsseparately. - Do not inject server keys into clients via
define,import.meta.envor empty prefixloadEnv. - Do not put heavy libraries such as GSAP, Three.js, Lottie, Monaco, and Map SDK into all page sharing entries; first evaluate the impact of async chunk and first screen.
Expected Output
The output should include project type judgment, key configuration changes, environment variable security instructions, and build/development performance verification methods. When completed, the Vite configuration should be type-checked, buildable, secret-secure, and explain the differences between dev and build.
Top skills in this category
Skill Vetter
@spclaudehomeSecurity-first skill vetting for AI agents. Use before installing any skill from ClawdHub, GitHub, or other sources. Checks for red flags, permission scope, and suspicious patterns.
Github
@steipeteInteract with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
Humanizer
@biostartechnologyRemove signs of AI-generated writing from text. Use when editing or reviewing text to make it sound more natural and human-written. Based on Wikipedia's comprehensive "Signs of AI writing" guide. Detects and fixes patterns including: inflated symbolism, promotional language, superficial -ing analyses, vague attributions, em dash overuse, rule of three, AI vocabulary words, negative parallelisms, and excessive conjunctive phrases.
Free Ride - Unlimited free AI
@shaivpidadiManages free AI models from OpenRouter for OpenClaw. Automatically ranks models by quality, configures fallbacks for rate-limit handling, and updates opencla...
Elite Longterm Memory
@nextfrontierbuildsUltimate AI agent memory system for Cursor, Claude, ChatGPT & Copilot. WAL protocol + vector search + git-notes + cloud backup. Never lose context again. Vibe-coding ready.