mirror of
https://github.com/Instadapp/vue-web3.git
synced 2024-07-29 21:48:25 +00:00
26 lines
572 B
TypeScript
26 lines
572 B
TypeScript
import { watch } from 'chokidar'
|
|
import { build } from 'unbuild'
|
|
import { resolve } from 'upath'
|
|
import consola from 'consola'
|
|
|
|
// Package root
|
|
const rootDir = resolve(__dirname, '..')
|
|
// Package src
|
|
const src = resolve(__dirname, '../src')
|
|
|
|
// Package build promise
|
|
const tryBuild = async () => {
|
|
try {
|
|
await build(rootDir, false)
|
|
} catch (e) {
|
|
consola.log(e)
|
|
} finally {
|
|
consola.info('Waiting for changes...')
|
|
}
|
|
}
|
|
|
|
// Watch src, rebuild on any change
|
|
watch(src).on('change', tryBuild)
|
|
watch(src).on('add', tryBuild)
|
|
watch(src).on('unlink', tryBuild)
|