From knowledge-patch
Configures, upgrades, extends, or troubleshoots Vite with migration checks for Node.js requirements, removed APIs, browser targets, and Vitest compatibility.
How this skill is triggered — by the user, by Claude, or both
Slash command
/knowledge-patch:vite-knowledge-patchThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Use this skill when configuring, upgrading, extending, or troubleshooting Vite.
Use this skill when configuring, upgrading, extending, or troubleshooting Vite. Start with the migration checks, then open the topic reference that matches the work at hand.
| Reference | Topics |
|---|---|
| Builds and dependency optimization | Bundled development, chunk import maps, and the Rolldown-backed package |
| Development server and assets | HMR-aware bundled development, case-insensitive globs, and custom HTML asset sources |
| Migration and runtime requirements | Node.js support, browser targets, Vitest compatibility, and removed APIs |
| Plugin and framework APIs | Environment API and coordinated multi-environment builds |
| Resolution and module interoperability | ESM-only packaging, CommonJS loading, and direct WebAssembly ESM imports |
| Transforms, TypeScript, and styles | Lightning CSS interoperability and Sass legacy API removal |
Before upgrading a project or CI image, inspect node --version.
The newer minimums provide unflagged require(esm). Vite can therefore be
distributed as ESM-only while keeping its JavaScript API loadable from
CommonJS.
Search an upgrading project for both of these before changing the Vite major:
rg "splitVendorChunkPlugin|legacy API" .
Vite 7 removes:
splitVendorChunkPlugin.Migrate either dependency before expecting the upgraded build to work.
The default build.target is now 'baseline-widely-available', fixed for each
Vite major, rather than 'modules'. In Vite 7, that default means Chrome 107,
Edge 107, Firefox 104, and Safari 16.0.
Set build.target explicitly when the application's browser contract differs
from those defaults. Do not assume that leaving the target unset preserves the
previous output compatibility.
Vite 7 support begins with Vitest 3.2. Upgrade older Vitest installations when upgrading Vite rather than diagnosing the combination as an application bug.
The experimental bundled development mode serves bundled ESM while retaining HMR. It can reduce per-module request overhead that slows startup and reloads in large applications.
Enable it from the CLI:
vite --experimental-bundle
Or enable it in configuration:
import { defineConfig } from 'vite'
export default defineConfig({
experimental: { bundledDev: true },
})
The mode remains experimental and limited. Validate framework integration and development behavior before adopting it for the whole team.
build.chunkImportMap prevents a changed chunk hash from cascading into every
chunk that imports it. This can preserve more cached files between deployments.
import { defineConfig } from 'vite'
export default defineConfig({
build: { chunkImportMap: true },
})
Do not combine this option with experimental.renderBuiltUrl; the two are
currently incompatible.
WebAssembly ESM integration supports direct named exports from .wasm files:
import { add } from './add.wasm'
console.log(add(1, 2))
A ?init wrapper is not required for this direct ESM form.
Use html.additionalAssetSources when custom elements or nonstandard
attributes contain asset URLs:
import { defineConfig } from 'vite'
export default defineConfig({
html: {
additionalAssetSources: {
'html-import': { srcAttributes: 'src' },
img: { srcAttributes: ['data-src-dark', 'data-src-light'] },
},
},
})
Those files then enter Vite's normal asset-processing pipeline.
Pass caseSensitive: false to import.meta.glob when filename case should not
affect the match:
const modules = import.meta.glob('./dir/module*.js', {
caseSensitive: false,
})
With css.transformer: 'lightningcss', CSS files can import external CSS files
and plugins can register file dependencies. These capabilities close two prior
compatibility gaps with the PostCSS transformer.
import { defineConfig } from 'vite'
export default defineConfig({
css: { transformer: 'lightningcss' },
})
The experimental Environment API lets framework and plugin authors implement development integrations that more closely match production. Normal single-client SPA behavior is unchanged, and existing custom SSR applications remain backward compatible.
For coordinated build work, the API exposes a buildApp hook so plugins
can coordinate builds across multiple environments. Treat the API as
experimental and keep integration code isolated behind framework or plugin
boundaries.
To evaluate the future Rolldown-based bundler, replace the vite package with
rolldown-vite. It is intended as a drop-in trial package before Rolldown
becomes the default; test plugin and build behavior before committing to it.
npx claudepluginhub nevaberry/nevaberry-plugins --plugin knowledge-patchProvides advanced Vite 8 patterns including Rolldown-powered builds, advancedChunks, Environment API, SSR configuration, library mode, and plugin development. Use when customizing build pipelines or configuring multi-environment builds.
Configures Vite build tool, plugin API, SSR, and Vite 8 Rolldown migration. Activates when working with Vite projects, vite.config.ts, Vite plugins, or building libraries/SSR apps.
Configures Vite build tool, plugin API, SSR, and Vite 8 Rolldown migration. Auto-activates when working with vite.config.ts, Vite plugins, or building SSR apps.