forked from SAP/ui5-language-assistant
-
Notifications
You must be signed in to change notification settings - Fork 0
/
esbuild.js
40 lines (37 loc) · 914 Bytes
/
esbuild.js
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
async function builder(options) {
const buildConfig = {
...{
logLevel: "info",
write: true,
format: "cjs",
bundle: true,
metafile: true,
sourcemap: true, // .vscodeignore ignores .map files when bundling!!
mainFields: ["module", "main"], // https://stackoverflow.com/a/69352281
minify: true,
loader: {
".jpg": "file",
".gif": "file",
".mp4": "file",
".graphql": "text",
".png": "file",
".svg": "file",
},
platform: "node",
target: "node14",
},
...options,
};
if (process.argv.slice(2).includes("--watch")) {
console.log("Applyin watch config");
buildConfig.watch = true;
buildConfig.minify = false;
}
require("esbuild")
.build(buildConfig)
.catch((error) => {
console.log(error);
process.exit(1);
});
}
module.exports = { builder };