Files

24 lines
515 B
JavaScript

import { createServer, build } from 'vite'
// Build watcher : écrit les fichiers dist sur disque en continu
const watcher = await build({
build: { watch: {} },
})
// Dev server : HMR sur localhost:5173
const server = await createServer()
await server.listen()
console.log('\n HMR actif + dist générés en watch\n')
const shutdown = async () => {
await Promise.allSettled([
watcher.close(),
server.close(),
])
process.exit(0)
}
process.on('SIGINT', shutdown)
process.on('SIGTERM', shutdown)