Home

Awesome

Vite-plugin-bundle-prefetch

Why

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.

How

some steps taken by vite-plugin-bundle-prefetch

Usage

// vite.config.js
import prefetchPlugin from 'vite-plugin-bundle-prefetch';

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

Options

excludeFn

export default {
  plugins: [
    prefetchPlugin({
      excludeFn: (assetName) => {
        return assetName.includes('ApproveRecords');
      },
    }),
  ],
};