Writing Vite plugins for development and builds
Follow Vite's plugin lifecycle across Rollup and Rolldown, then build a virtual module, development middleware, and HTML tag injection.
Follow Vite's plugin lifecycle across Rollup and Rolldown, then build a virtual module, development middleware, and HTML tag injection.
Reuse the Vite project configuration in Vitest, mock fetch in unit tests, and enforce V8 coverage thresholds in a CI workflow.
Set up a pnpm workspace for Vite apps and shared UI, keep React resolution consistent, and verify linked-package HMR and dependency-ordered builds.
Build separate React entries with Vite, render the server entry through Express, and verify that the response hydrates against the same initial state.
Build a React and TypeScript package in Vite library mode, expose ESM, CommonJS-compatible output, types, and CSS, then inspect the npm tarball.
Build a Vite transform plugin that exposes Markdown front matter and HTML as a typed module, then verify hot updates and production output.
Use transformIndexHtml and HtmlTagDescriptor to configure entry HTML, crawler directives, social metadata, and scripts per deployment mode.
Use a Connect middleware plugin to test same-origin API responses, status codes, latency, and failure states from one Vite dev process.
Use resolveId and load to expose typed build metadata as a virtual ES module without writing generated source files into the working tree.
Use a TypeScript tracer to inspect Vite configuration hooks, request-time transforms, HMR, and bundle output in Vite 7 and Vite 8.