A vite plugin for prefetching resources
there is no official rollup/vite plugin to work as the webpack prefetch plugin, we just have preload
in vite, but we really need the prefetch for some Scenario.
some steps taken by vite-plugin-bundle-prefetch
<link rel="prefetch" href="xxxx">
in head
npm i vite-plugin-bundle-prefetch -D
// vite.config.js
import prefetchPlugin from 'vite-plugin-bundle-prefetch';
export default {
plugins: [prefetchPlugin()],
};
Function(assetName:string)=>boolean
undefined
export default {
plugins: [
prefetchPlugin({
excludeFn: (assetName) => {
return assetName.includes('ApproveRecords');
},
}),
],
};