basic2/vite/plugins/restart.ts

15 lines
381 B
TypeScript
Raw Normal View History

2022-09-26 00:21:50 +08:00
import fs from 'node:fs'
import ViteRestart from 'vite-plugin-restart'
export default function createRestart() {
const pluginsFile: string[] = []
fs.readdirSync('vite/plugins').forEach((dirname) => {
2022-10-02 03:29:37 +08:00
if (fs.statSync(`vite/plugins/${dirname}`).isFile()) {
2022-09-26 00:21:50 +08:00
pluginsFile.push(`vite/plugins/${dirname}`)
2022-10-02 03:29:37 +08:00
}
2022-09-26 00:21:50 +08:00
})
return ViteRestart({
restart: pluginsFile,
})
}