-
Notifications
You must be signed in to change notification settings - Fork 0
/
esbuild.dev.js
47 lines (42 loc) · 1.12 KB
/
esbuild.dev.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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
const { context } = require("esbuild");
const LoggingPlugin = {
name: "logging",
setup(build) {
build.onStart(() => {
console.log("[watch] build started");
});
build.onEnd((result) => {
const warnings = result.warnings;
if (warnings.length > 0) {
warnings.forEach((warning) =>
console.warn(
`> ${warning.location.file}:${warning.location.line}:${warning.location.column}: warning: ${warning.text}`
)
);
}
const errors = result.errors;
if (errors.length > 0) {
errors.forEach((error) =>
console.error(
`> ${error.location.file}:${error.location.line}:${error.location.column}: error: ${error.text}`
)
);
}
console.log("[watch] build finished");
});
},
};
context({
entryPoints: ["./src/extension.ts"],
minify: false,
bundle: true,
outdir: "./out",
external: ["vscode", "esbuild-wasm", "tailwindcss"],
platform: "node",
plugins: [LoggingPlugin],
})
.then((ctx) => ctx.watch())
.catch((err) => {
process.stderr.write(err.stderr);
process.exit(1);
});