generated from technologiestiftung/template-repo-citylab
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathesbuild.config.cjs
45 lines (45 loc) · 985 Bytes
/
esbuild.config.cjs
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
/* eslint-disable no-console */
/* eslint-disable @typescript-eslint/no-var-requires */
//@ts-check
const glob = require("glob");
const entryPoints = glob.sync("./src/**/*.ts", {
ignore: [
"**/__tests__/**/*.ts",
"**/__test-utils/**/*.ts",
"**/*.test.ts",
"node_modules/**",
],
});
// process.exit(0);
require("esbuild")
.build({
platform: "node",
sourcemap: true,
treeShaking: true,
banner: {
js: '"use strict";',
},
target: ["esnext"],
format: "esm",
entryPoints,
outdir: "./dist",
tsconfig: "tsconfig.json",
})
.then((result) => {
console.info("Esbuild is processing these files:");
console.info(entryPoints.join("\n"));
if (result.outputFiles) {
console.info(result.outputFiles);
}
if (result.warnings.length > 0) {
console.warn(result.warnings);
}
if (result.errors.length > 0) {
console.error(result.errors);
}
console.log("⚡ Esbuild is done");
})
.catch((err) => {
console.error(err);
process.exit(1);
});