Skip to content

📦 Vite plugin for idle warming up the transform cache

License

Notifications You must be signed in to change notification settings

jh-leong/vite-plugin-idle-warmup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 awesome 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 warming up 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

About

📦 Vite plugin for idle warming up the transform cache

Resources

License

Stars

Watchers

Forks

Packages

No packages published