vite-plugin-route-prefetch
Version:
31 lines (24 loc) • 562 B
Markdown
✅ 自动识别路由懒加载的代码分割 chunk <br>
✅ 在构建时注入 prefetch 标签 <br>
✅ 智能跳过已有资源和 legacy 构建 <br>
✅ 支持自定义过滤规则
```bash
npm install vite-plugin-route-prefetch -D
pnpm add vite-plugin-route-prefetch -D
```
```js
// vite.config.ts
import { defineConfig } from 'vite'
import routePrefetch from 'vite-plugin-route-prefetch'
export default defineConfig({
plugins: [
routePrefetch(),
]
})
```