vite-preload-images-plugin
Version:
A Vite plugin that automatically generates preload tags for images in your build output
33 lines (30 loc) • 781 B
TypeScript
import { Plugin } from 'vite';
interface PreloadImagesOptions {
/**
* 需要预加载的图片目录列表
* @default ['src/assets']
*/
preloadDirs?: string[];
/**
* 需要特殊处理 fetchpriority 的目录
* @default ['gif']
*/
lowPriorityDirs?: string[];
/**
* 需要排除的文件列表
* @default []
*/
excludeFiles?: string[];
/**
* 支持的图片扩展名
* @default ['png', 'jpg', 'jpeg', 'gif', 'webp']
*/
imageExtensions?: string[];
/**
* 是否启用调试日志
* @default false
*/
debug?: boolean;
}
declare function preloadImagesPlugin(options?: PreloadImagesOptions): Plugin;
export { type PreloadImagesOptions, preloadImagesPlugin as default };