basic2/vite/plugins/restart.js
2022-05-02 16:37:26 +08:00

15 lines
396 B
JavaScript

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