UNPKG

pre-fetch-plugin

Version:

A pre-fetch plugin for Vite and Webpack

13 lines (12 loc) 373 B
import { injectScriptToHtml } from '../core/utils'; export function createVitePlugin(pluginOptions) { return { name: 'pre-fetch-plugin', transformIndexHtml: { enforce: 'pre', transform: async (html) => { return await injectScriptToHtml(html, pluginOptions.options); }, }, }; }