basic2/vite/plugins/restart.ts
2022-10-02 03:29:37 +08:00

15 lines
381 B
TypeScript

import fs from 'node:fs'
import ViteRestart from 'vite-plugin-restart'
export default function createRestart() {
const pluginsFile: string[] = []
fs.readdirSync('vite/plugins').forEach((dirname) => {
if (fs.statSync(`vite/plugins/${dirname}`).isFile()) {
pluginsFile.push(`vite/plugins/${dirname}`)
}
})
return ViteRestart({
restart: pluginsFile,
})
}