Skip to content

Latest commit

 

History

History

plugin

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

vite-plugin-refresh

Do full page reloads when the source code changes, including any non-dev dependencies.

Reloads are debounced so that changes to multiple watched files will cause fewer reloads.

Usage

Example: vite.config.ts

import { defineConfig } from 'vite';
import refresh from 'vite-plugin-refresh';

export default defineConfig({
  plugins: [refresh()],
});

Options

  • include?: string[]: Include (additional) dependencies in the watch list.
  • exclude?: string[]: Exclude dependencies from the watch list.
  • delay?: number: Delay page reloads by a number of milliseconds. Defaults to 1000.
  • log?: boolean: Log changed files and page reloads to the console. Defaults to false.

Example:

refresh({
  include: ['package-a'],
  exclude: ['package-b'],
  delay: 3000,
  log: true,
});

Monorepos

When continuously building a monorepo, it is recommended that you NOT delete build output on each rebuild. For example, when using Vite in "Library Mode", set the build.emptyOutDir option to false. When using the Typescript compiler in watch mode, don't set the --clean flag.