-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathesbuild.js
42 lines (38 loc) · 949 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
41
42
const { build } = require("esbuild");
const { definePlugin } = require('esbuild-plugin-define');
const date = new Date();
const copyright = `/* datalayer-helper (${date.toISOString()}). Copyright ${date.getFullYear()} Toni Arndt. This work is licensed under the terms of the MIT license. For a copy, see <https://github.com/toniarndt/datalayer-helper/blob/main/LICENSE>. */`
const sharedConfig = {
entryPoints: ['./src/index.ts'],
bundle: true,
loader: {
'.ts': 'ts',
},
globalName: 'd',
legalComments: 'none',
format: 'iife',
banner: {
js: copyright
},
tsconfig: './tsconfig.json',
define: {},
plugins: [
definePlugin({
process: {
env: {
builddate: date.toISOString(),
}
},
}),
],
};
build({
...sharedConfig,
minify: false,
outfile: "./dist/datalayer-helper.js",
});
build({
...sharedConfig,
minify: true,
outfile: "./dist/datalayer-helper.min.js",
});