-
Notifications
You must be signed in to change notification settings - Fork 0
/
bundle.js
57 lines (50 loc) · 953 Bytes
/
bundle.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/* eslint-disable @typescript-eslint/no-var-requires */
const esbuild = require("esbuild");
const opts = {
entryPoints: ["src/index.ts"],
bundle: true,
sourcemap: true,
logLevel: "info",
};
const cjsOpts = {
...opts,
format: "cjs",
platform: "node",
target: "node14",
};
const esmOpts = {
...opts,
format: "esm",
platform: "browser",
target: "ES2017",
};
// CJS (node)
esbuild
.build({
...cjsOpts,
minify: false,
outfile: "dist/scalingo.js",
})
.catch(() => process.exit(1));
esbuild
.build({
...cjsOpts,
minify: true,
outfile: "dist/scalingo.min.js",
})
.catch(() => process.exit(1));
// ESM (browser or before transpiling)
esbuild
.build({
...esmOpts,
minify: false,
outfile: "dist/scalingo.esm.js",
})
.catch(() => process.exit(1));
esbuild
.build({
...esmOpts,
minify: true,
outfile: "dist/scalingo.min.esm.js",
})
.catch(() => process.exit(1));