-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathesbuild.js
More file actions
52 lines (46 loc) · 1.13 KB
/
esbuild.js
File metadata and controls
52 lines (46 loc) · 1.13 KB
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
48
49
50
51
52
import esbuild from "esbuild";
import fs from "node:fs";
import path from "node:path";
const copyVtRouteGraphicsBundle = () => {
const source = path.resolve(
"node_modules",
"route-graphics",
"dist",
"RouteGraphics.js",
);
const target = path.resolve("vt", "static", "RouteGraphics.js");
if (!fs.existsSync(source)) {
throw new Error(
"Missing route-graphics dist bundle. Run `bun install` before building VT assets.",
);
}
fs.mkdirSync(path.dirname(target), { recursive: true });
fs.copyFileSync(source, target);
};
esbuild
.build({
bundle: true,
minify: true,
sourcemap: false,
format: "esm",
outfile: `./dist/RouteEngine.js`,
entryPoints: [`src/index.js`],
})
.then(() => console.log("Build completed"))
.catch(() => {
console.log("Build failed");
});
copyVtRouteGraphicsBundle();
esbuild
.build({
bundle: true,
minify: true,
sourcemap: true,
format: "esm",
outfile: `./vt/static/RouteEngine.js`,
entryPoints: [`src/index.js`],
})
.then(() => console.log("Build completed"))
.catch(() => {
console.log("Build failed");
});