-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathesbuild.js
More file actions
35 lines (31 loc) · 760 Bytes
/
esbuild.js
File metadata and controls
35 lines (31 loc) · 760 Bytes
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
import esbuild from "esbuild";
const isWatchMode = process.argv.includes("--watch");
const teams = ["explore", "decide", "checkout"];
const buildOptions = [];
teams.forEach((team) => {
buildOptions.push(
{
entryPoints: [`src/${team}/scripts.js`],
outfile: `public/${team}/static/scripts.js`,
},
{
entryPoints: [`src/${team}/styles.css`],
external: ["*.woff2"],
outfile: `public/${team}/static/styles.css`,
},
);
});
buildOptions.forEach(async (options) => {
let opts = {
bundle: true,
minify: true,
logLevel: "info",
...options,
};
if (isWatchMode) {
let ctx = await esbuild.context(opts);
ctx.watch();
} else {
esbuild.build(opts).catch(() => process.exit(1));
}
});