Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/simon-he95/unplugin-dns-prefetch
https://github.com/simon-he95/unplugin-dns-prefetch
Last synced: 10 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/simon-he95/unplugin-dns-prefetch
- Owner: Simon-He95
- License: mit
- Created: 2023-05-17T02:55:17.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-09-28T08:21:00.000Z (about 1 month ago)
- Last Synced: 2024-10-13T08:09:24.769Z (24 days ago)
- Language: Vue
- Size: 57.6 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: license
Awesome Lists containing this project
README
English | 简体中文
自动检测收集打包文件中的外部链接,提升到index.html的head顶部生成dns-prefetch,让dns更早的去做解析
## 🧩 使用
Vite
```ts
// 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
```ts
// rollup.config.js
import { rollupDnsPrefetchPlugin } from 'unplugin-dns-prefetch'
export default {
plugins: [
rollupDnsPrefetchPlugin(),
],
}
```
Webpack
```ts
// webpack.config.js
module.exports = {
/* ... */
plugins: [
require('unplugin-dns-prefetch').webpackDnsPrefetchPlugin(),
],
}
```
Vue CLI
```ts
// vue.config.js
module.exports = {
configureWebpack: {
plugins: [
require('unplugin-dns-prefetch').webpackDnsPrefetchPlugin(),
],
},
}
```
ESBuild
```ts
// esbuild.config.js
import { build } from 'esbuild'
import { esbuildDnsPrefetchPlugin } from 'unplugin-dns-prefetch'build({
plugins: [esbuildDnsPrefetchPlugin()],
})
```## License
[MIT](./LICENSE) License © 2022 [Simon He](https://github.com/Simon-He95)