File contents Vite Best Practices
Comprehensive performance optimization guide for Vite applications. Contains 42 rules across 8 categories, prioritized by impact to guide automated refactoring and code generation.
When to Apply
Reference these guidelines when:
Configuring Vite for a new project
Troubleshooting slow dev server startup
Optimizing production bundle size
Debugging HMR issues
Writing or evaluating Vite plugins
Migrating from Webpack or other bundlers
Rule Categories by Priority
Priority
Category
Impact
Prefix
1
Dependency Pre-bundling
CRITICAL
deps-
2
Plugin Performance
CRITICAL
plugin-
3
Bundle Optimization
CRITICAL
bundle-
4
Import Resolution
HIGH
import-
5
Build Configuration
HIGH
build-
6
Development Server
MEDIUM-HIGH
dev-
7
CSS Optimization
MEDIUM
css-
8
Advanced Patterns
LOW-MEDIUM
advanced-
Quick Reference
1. Dependency Pre-bundling (CRITICAL)
deps-include-large-cjs - Include large dependencies with many modules
deps-exclude-esm - Exclude small ESM dependencies
deps-force-rebundle - Use --force flag for dependency changes
deps-hold-until-crawl - Configure holdUntilCrawlEnd for startup behavior
deps-entries - Configure custom entry points for discovery
deps-linked-packages - Handle linked dependencies in monorepos
2. Plugin Performance (CRITICAL)
plugin-lazy-imports - Use dynamic imports in plugin code
plugin-avoid-long-hooks - Avoid long operations in startup hooks
plugin-transform-early-return - Early return in transform hooks
plugin-audit-community - Audit community plugins for performance
plugin-swc-over-babel - Use SWC instead of Babel for React
3. Bundle Optimization (CRITICAL)
bundle-manual-chunks - Use manualChunks for vendor splitting
bundle-dynamic-imports - Use dynamic imports for route-level splitting
bundle-analyze - Analyze bundle composition
bundle-tree-shaking - Enable effective tree-shaking
bundle-chunk-warning - Address large chunk warnings
bundle-compression - Disable compressed size reporting for large projects
bundle-asset-inlining - Configure asset inlining threshold
4. Import Resolution (HIGH)
import-avoid-barrel - Avoid barrel file imports
import-explicit-extensions - Use explicit file extensions
import-path-aliases - Configure path aliases for clean imports
import-svg-strings - Import SVGs as strings instead of components
import-glob-patterns - Use glob imports carefully
5. Build Configuration (HIGH)
build-modern-target - Target modern browsers
build-minification - Use esbuild for minification
build-sourcemaps - Disable source maps in production
build-css-code-split - Enable CSS code splitting
build-rolldown - Consider Rolldown for faster builds
build-output-dir - Configure output directory and caching
6. Development Server (MEDIUM-HIGH)
dev-server-warmup - Warm up frequently used files
dev-browser-cache - Keep browser cache enabled in DevTools
dev-fs-limits - Increase file descriptor limits on Linux
dev-wsl-polling - Use polling for WSL file watching
dev-https-proxy - Configure HTTPS and proxy for development
7. CSS Optimization (MEDIUM)
css-lightning - Use Lightning CSS instead of PostCSS
css-avoid-preprocessors - Prefer CSS over preprocessors when possible
css-modules - Use CSS Modules for component styles
css-inline-critical - Extract critical CSS for initial paint
8. Advanced Patterns (LOW-MEDIUM)
advanced-ssr-externalize - Externalize dependencies for SSR
advanced-env-static - Use static environment variables
advanced-profiling - Profile build performance
advanced-lib-mode - Configure library mode for package development
How to Use
Read individual reference files for detailed explanations and code examples:
Section definitions - Category structure and impact levels
Rule template - Template for adding new rules
Reference Files
File
Description
AGENTS.md
Complete compiled guide with all rules
references/_sections.md
Category definitions and ordering
assets/templates/_template.md
Template for new rules
metadata.json
Version and reference information
1 --- 2 name: vite-2 3 description: Vite Best Practices 4 --- 5 # Vite Best Practices 6 7 Comprehensive performance optimization guide for Vite applications. Contains 42 rules across 8 categories, prioritized by impact to guide automated refactoring and code generation. 8 9 ## When to Apply 10 11 Reference these guidelines when: 12 - Configuring Vite for a new project 13 - Troubleshooting slow dev server startup 14 - Optimizing production bundle size 15 - Debugging HMR issues 16 - Writing or evaluating Vite plugins 17 - Migrating from Webpack or other bundlers 18 19 ## Rule Categories by Priority 20 21 | Priority | Category | Impact | Prefix | 22 |----------|----------|--------|--------| 23 | 1 | Dependency Pre-bundling | CRITICAL | `deps-` | 24 | 2 | Plugin Performance | CRITICAL | `plugin-` | 25 | 3 | Bundle Optimization | CRITICAL | `bundle-` | 26 | 4 | Import Resolution | HIGH | `import-` | 27 | 5 | Build Configuration | HIGH | `build-` | 28 | 6 | Development Server | MEDIUM-HIGH | `dev-` | 29 | 7 | CSS Optimization | MEDIUM | `css-` | 30 | 8 | Advanced Patterns | LOW-MEDIUM | `advanced-` | 31 32 ## Quick Reference 33 34 ### 1. Dependency Pre-bundling (CRITICAL) 35 36 - [`deps-include-large-cjs`](references/deps-include-large-cjs.md) - Include large dependencies with many modules 37 - [`deps-exclude-esm`](references/deps-exclude-esm.md) - Exclude small ESM dependencies 38 - [`deps-force-rebundle`](references/deps-force-rebundle.md) - Use --force flag for dependency changes 39 - [`deps-hold-until-crawl`](references/deps-hold-until-crawl.md) - Configure holdUntilCrawlEnd for startup behavior 40 - [`deps-entries`](references/deps-entries.md) - Configure custom entry points for discovery 41 - [`deps-linked-packages`](references/deps-linked-packages.md) - Handle linked dependencies in monorepos 42 43 ### 2. Plugin Performance (CRITICAL) 44 45 - [`plugin-lazy-imports`](references/plugin-lazy-imports.md) - Use dynamic imports in plugin code 46 - [`plugin-avoid-long-hooks`](references/plugin-avoid-long-hooks.md) - Avoid long operations in startup hooks 47 - [`plugin-transform-early-return`](references/plugin-transform-early-return.md) - Early return in transform hooks 48 - [`plugin-audit-community`](references/plugin-audit-community.md) - Audit community plugins for performance 49 - [`plugin-swc-over-babel`](references/plugin-swc-over-babel.md) - Use SWC instead of Babel for React 50 51 ### 3. Bundle Optimization (CRITICAL) 52 53 - [`bundle-manual-chunks`](references/bundle-manual-chunks.md) - Use manualChunks for vendor splitting 54 - [`bundle-dynamic-imports`](references/bundle-dynamic-imports.md) - Use dynamic imports for route-level splitting 55 - [`bundle-analyze`](references/bundle-analyze.md) - Analyze bundle composition 56 - [`bundle-tree-shaking`](references/bundle-tree-shaking.md) - Enable effective tree-shaking 57 - [`bundle-chunk-warning`](references/bundle-chunk-warning.md) - Address large chunk warnings 58 - [`bundle-compression`](references/bundle-compression.md) - Disable compressed size reporting for large projects 59 - [`bundle-asset-inlining`](references/bundle-asset-inlining.md) - Configure asset inlining threshold 60 61 ### 4. Import Resolution (HIGH) 62 63 - [`import-avoid-barrel`](references/import-avoid-barrel.md) - Avoid barrel file imports 64 - [`import-explicit-extensions`](references/import-explicit-extensions.md) - Use explicit file extensions 65 - [`import-path-aliases`](references/import-path-aliases.md) - Configure path aliases for clean imports 66 - [`import-svg-strings`](references/import-svg-strings.md) - Import SVGs as strings instead of components 67 - [`import-glob-patterns`](references/import-glob-patterns.md) - Use glob imports carefully 68 69 ### 5. Build Configuration (HIGH) 70 71 - [`build-modern-target`](references/build-modern-target.md) - Target modern browsers 72 - [`build-minification`](references/build-minification.md) - Use esbuild for minification 73 - [`build-sourcemaps`](references/build-sourcemaps.md) - Disable source maps in production 74 - [`build-css-code-split`](references/build-css-code-split.md) - Enable CSS code splitting 75 - [`build-rolldown`](references/build-rolldown.md) - Consider Rolldown for faster builds 76 - [`build-output-dir`](references/build-output-dir.md) - Configure output directory and caching 77 78 ### 6. Development Server (MEDIUM-HIGH) 79 80 - [`dev-server-warmup`](references/dev-server-warmup.md) - Warm up frequently used files 81 - [`dev-browser-cache`](references/dev-browser-cache.md) - Keep browser cache enabled in DevTools 82 - [`dev-fs-limits`](references/dev-fs-limits.md) - Increase file descriptor limits on Linux 83 - [`dev-wsl-polling`](references/dev-wsl-polling.md) - Use polling for WSL file watching 84 - [`dev-https-proxy`](references/dev-https-proxy.md) - Configure HTTPS and proxy for development 85 86 ### 7. CSS Optimization (MEDIUM) 87 88 - [`css-lightning`](references/css-lightning.md) - Use Lightning CSS instead of PostCSS 89 - [`css-avoid-preprocessors`](references/css-avoid-preprocessors.md) - Prefer CSS over preprocessors when possible 90 - [`css-modules`](references/css-modules.md) - Use CSS Modules for component styles 91 - [`css-inline-critical`](references/css-inline-critical.md) - Extract critical CSS for initial paint 92 93 ### 8. Advanced Patterns (LOW-MEDIUM) 94 95 - [`advanced-ssr-externalize`](references/advanced-ssr-externalize.md) - Externalize dependencies for SSR 96 - [`advanced-env-static`](references/advanced-env-static.md) - Use static environment variables 97 - [`advanced-profiling`](references/advanced-profiling.md) - Profile build performance 98 - [`advanced-lib-mode`](references/advanced-lib-mode.md) - Configure library mode for package development 99 100 ## How to Use 101 102 Read individual reference files for detailed explanations and code examples: 103 104 - [Section definitions](references/_sections.md) - Category structure and impact levels 105 - [Rule template](assets/templates/_template.md) - Template for adding new rules 106 107 ## Reference Files 108 109 | File | Description | 110 |------|-------------| 111 | [AGENTS.md](AGENTS.md) | Complete compiled guide with all rules | 112 | [references/_sections.md](references/_sections.md) | Category definitions and ordering | 113 | [assets/templates/_template.md](assets/templates/_template.md) | Template for new rules | 114 | [metadata.json](metadata.json) | Version and reference information |
ComeOnOliver/skillshub/tree/main/skills/pproenca/dot-skills/vite commit 8bf992790b
Frequently asked questions How do I install the Vite skill? Run npx skillmds@latest add comeonoliver/vite-2 in your terminal (requires Node.js), paste this page's agent-chat prompt into Claude, Cursor, or any MCP-connected agent, or download the SKILL.md file and copy it into your agent's skills directory.
What does the Vite skill do? Vite Best Practices It is listed under Coding & Dev Tools on SkillMD.
Is Vite safe to use? This skill has not completed SkillMD's automated safety review yet. Independent scanners report: SkillSpector: PASS, Skill Scanner: PASS. SkillMD never runs a skill's scripts for you; review the SKILL.md before installing.
Which AI agents work with Vite? This skill is tagged as working with Claude Code, Claude.ai, OpenAI Codex. SKILL.md is an open format, so most agents that read a skills directory can load it too.
Is Vite free to use? Yes. Installing skills from SkillMD is free, and the skill stays under its author's original license.
Who published Vite? ComeOnOliver (@comeonoliver) published this skill. Their other Agent Skills are listed on their SkillMD profile.