0.0.2 • Published 12 months ago

unplugin-dns-prefetch v0.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
12 months ago

自动检测收集打包文件中的外部链接,提升到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()],
})

License

MIT License © 2022 Simon He

0.0.2

12 months ago