-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwatch.js
29 lines (28 loc) · 829 Bytes
/
watch.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
const { exec } = require('child_process');
require('esbuild')
.context({
entryPoints: ['index.ts'],
outdir: 'dist',
bundle: true,
format: 'esm',
plugins: [
{
name: 'on-end',
setup(build) {
build.onStart(() => {
console.log('Cleaning up...');
exec('rm -rf dist');
});
build.onEnd(() => {
console.log('Building types...');
exec('npx tsc --outDir dist');
console.log('Build success!');
});
},
},
]
})
.then((context) => context.watch())
.then(() => {
console.log('Watching...');
});