unplugin-dns-prefetch
v0.0.2
Published
unplugin-dns-prefetch
Downloads
2
Readme
自动检测收集打包文件中的外部链接,提升到index.html的head顶部生成dns-prefetch,让dns更早的去做解析
🧩 使用
// vite.config.ts
import { defineConfig } from 'vite'
import { viteDnsPrefetchPlugin } from 'unplugin-dns-prefetch'
import vue from '@vitejs/plugin-vue'
import type { PluginOption } from 'vite'
export default defineConfig({
plugins: [
vue(),
viteDnsPrefetchPlugin(),
],
})
// rollup.config.js
import { rollupDnsPrefetchPlugin } from 'unplugin-dns-prefetch'
export default {
plugins: [
rollupDnsPrefetchPlugin(),
],
}
// webpack.config.js
module.exports = {
/* ... */
plugins: [
require('unplugin-dns-prefetch').webpackDnsPrefetchPlugin(),
],
}
// vue.config.js
module.exports = {
configureWebpack: {
plugins: [
require('unplugin-dns-prefetch').webpackDnsPrefetchPlugin(),
],
},
}
// esbuild.config.js
import { build } from 'esbuild'
import { esbuildDnsPrefetchPlugin } from 'unplugin-dns-prefetch'
build({
plugins: [esbuildDnsPrefetchPlugin()],
})