-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathbundle.mjs
More file actions
31 lines (29 loc) · 840 Bytes
/
bundle.mjs
File metadata and controls
31 lines (29 loc) · 840 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
import esbuild from "esbuild";
import path from "path";
const toBundle = [
{ packageName: "yaml", outputDir: "yaml" },
{ packageName: "@xmldom/xmldom", outputDir: "xmldom" },
];
for (const { packageName, outputDir } of toBundle) {
const entry = import.meta.resolve(packageName);
const outputPath = new URL(
path.resolve("./modules/third-party", outputDir),
import.meta.url,
).pathname;
const url = new URL(entry);
await esbuild.build({
entryPoints: [url.pathname],
bundle: true,
platform: "browser",
target: "es2022",
legalComments: "linked",
keepNames: true,
treeShaking: true,
minifyIdentifiers: false,
minifySyntax: false,
minifyWhitespace: false,
conditions: ["workerd", "worker", "browser"],
format: "esm",
outfile: path.join(outputPath, "index.js"),
});
}