vite-plugin-idle-warmup
TypeScript icon, indicating that this package has built-in type declarations

0.0.2 • Public • Published

vite-plugin-idle-warmup

npm version bundle JSDocs License

🚀 Optimize your Vite app's speed by warming up Vite's transform cache during server idle periods.

why

Vite comes with a powerful built-in feature for warming up the cache, as outlined in Warm Up Frequently Used Files and vite-plugin-warmup.

However, when we want to warm up resources for lazily loaded pages, the fact that Vite's transform cache is generated during server startup can lead to longer initial page load times.

vite-plugin-idle-warmup is a Vite plugin that optimizes server response times by performing idle warming up of Vite's transform cache during server idle periods. It helps to enhance the user experience by reducing the loading times for subsequent requests.

Usage

Example project: playground

Setup

Install vite-plugin-idle-warmup:

npm i -D vite-plugin-idle-warmup

Use the Vite plugin:

// vite.config.js
import { defineConfig } from 'vite';
import idleWarmup from 'vite-plugin-idle-warmup';

export default defineConfig({
  plugins: [idleWarmup({ files: ['./src/foo.ts', './src/BarComp.vue'] })],
});

The files can be direct file names or glob patterns using fast-glob.

License

MIT License © 2024-PRESENT Tycho

Package Sidebar

Install

npm i vite-plugin-idle-warmup

Weekly Downloads

1

Version

0.0.2

License

MIT

Unpacked Size

9.38 kB

Total Files

8

Last publish

Collaborators

  • tycho011868