Registry / devops / vite-plugin-warmup

vite-plugin-warmup

JSON →
library0.1.0jsnpmunverified

A Vite plugin that pre-warms the transform cache by transforming specified files and their imported JS modules recursively as soon as the dev server initializes. Current stable version 0.1.0 (released 2023), with an irregular release cadence. Key differentiators: focuses on warm-up only (not a framework-specific solution), supports both client and SSR files via glob patterns, and integrates with Vite's native transform pipeline. It solves the on-demand nature of Vite and deep module graph waterfall issues by caching hot-path files ahead of time. Requires Vite >=4.3 and does not support middlewareMode.

npm install vite-plugin-warmup
INSTALL
IMPORT
SIG · VITE-PLUGIN-WARMUP
V
vite-plugin-warmup
devopsjavascriptv0.1.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

warmup
import { warmup } from 'vite-plugin-warmup'
import warmup from 'vite-plugin-warmup'
Named export, not default. TypeScript types included.
warmupFile
import { warmupFile } from 'vite-plugin-warmup'
const { warmupFile } = require('vite-plugin-warmup')
ESM-only; warmupFile is a utility function for programmatic warmup.

Demonstrates basic Vite config with warmup plugin to pre-transform HTML and JSX files on server start.

import { defineConfig } from 'vite'; import { warmup } from 'vite-plugin-warmup'; export default defineConfig({ plugins: [ warmup({ clientFiles: ['./**/*.html', './src/components/*.jsx'], ssrFiles: [] }) ] });
Debug
Known issues
breakingDoes not work with `middlewareMode`.
fix
Do not use with middlewareMode; consider alternative warmup strategies.
affects: >=0.1.0
deprecatedDeprecated? No warnings yet. Plugin is new and stable.
gotchaOnly actual files in the file system are supported; cannot warm up virtual modules or URLs.
fix
Ensure all paths in clientFiles/ssrFiles correspond to real files.
affects: >=0.1.0
gotchaMetaframeworks that don't load files through Vite directly may not work with this plugin.
fix
Use DEBUG='vite:transform' to verify warmup is happening; if not, use warmupFile() programmatically.
affects: >=0.1.0
gotchaEnabling too many files may overload the Vite server on startup.
fix
Only warm up files known to be on the hot path.
affects: >=0.1.0
Errors
Common errors & fixes
Error: Cannot find module 'vite-plugin-warmup'
Package not installed.
fix
Run npm install vite-plugin-warmup
TypeError: (0 , warmup) is not a function
Incorrect import (default instead of named).
fix
Use import { warmup } from 'vite-plugin-warmup'
Error [ERR_REQUIRE_ESM]: require() of ES Module
Using require() instead of import.
fix
Switch to ESM: use import or dynamic import().
Upgrade
Version history
0.1.0latest on npm
Audit
Dependencies
viterequiredpeer dependency, requires Vite >=4.3
Agent activity
6 hits · last 30 days
node
6
Resources
vite-plugin-warmup — npm install vite-plugin-warmup · libregistry