-
Notifications
You must be signed in to change notification settings - Fork 7
/
esbuild.mjs
36 lines (34 loc) · 898 Bytes
/
esbuild.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
import * as esbuild from "esbuild"
import postcss from "esbuild-postcss"
const devMode = process.argv.includes("watch")
const ctx = await esbuild.context({
entryPoints: ["./src/default.js", "./src/overrides.css", "./src/editor.js"],
minify: true,
bundle: true,
target: "es6",
plugins: [
postcss(),
{
name: "rebuild-notify",
setup(build) {
build.onEnd((result) => {
if (result.errors.length) {
console.error(result.errors)
} else {
console.debug("Rebuild succesful.")
}
})
},
},
],
outdir: "django_prose_editor/static/django_prose_editor/",
// I really like sourcemaps, but I don't want to distribute them here.
// People can check the open source package after all.
// sourcemap: devMode,
})
if (devMode) {
await ctx.watch()
} else {
await ctx.rebuild()
ctx.dispose()
}