-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathesbuild.mjs
More file actions
30 lines (27 loc) · 872 Bytes
/
esbuild.mjs
File metadata and controls
30 lines (27 loc) · 872 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
import * as esbuild from "esbuild";
if (process.argv.length != 3) {
console.log("Invalid arguments");
} else {
const settings = {
entryPoints: ["src/fractal.ts"],
bundle: true,
minify: true,
target: ["chrome58","firefox57","safari16","edge80"],
outfile: "static/fractal.js",
banner: {
js: "// Looking for source?\n// https://github.com/Naitronbot/Fractal-Renderer/\n"
}
};
if (process.argv[2] === "watch") {
const ctx = await esbuild.context(settings);
await ctx.watch();
} else if (process.argv[2] === "build") {
await esbuild.build(settings);
} else if (process.argv[2] === "dev") {
settings.minify = false;
settings.sourcemap = true;
await esbuild.build(settings);
} else {
console.log("Invalid arguments");
}
}