0.0.2 ā€¢ Published 4 months ago

vite-plugin-idle-warmup v0.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

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

0.0.2

4 months ago

0.0.1

4 months ago