-
Notifications
You must be signed in to change notification settings - Fork 5
/
esbuild_dev.mjs
38 lines (32 loc) · 1.02 KB
/
esbuild_dev.mjs
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
30
31
32
33
34
35
36
37
38
import * as esbuild from 'esbuild';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
let buildEndPlugin = {
name: 'buildEndPlugin',
setup(build) {
build.onEnd(result => {
console.log(`Build ended with \x1b[31m${result.errors.length} errors\x1b[0m and \x1b[33m${result.warnings.length} warnings\x1b[0m`);
result.errors.forEach((e) => {
console.log(`\n`);
console.log(`\x1b[41m-- ERROR --\x1b[0m `);
console.log(` ${e.text}`);
console.log(` ${e.location.file} ${e.location.line}:${e.location.column}`);
});
// if (result.errors.length > 0) {
// process.exit(1);
// }
})
},
}
let ctx = await esbuild.context({
entryPoints: [path.resolve(__dirname, './src/videojs-vjstranscribe.js')],
outdir: "dist",
bundle: true,
metafile: true,
platform: "browser",
plugins: [buildEndPlugin]
})
await ctx.watch();
console.log('watching...')