-
-
Notifications
You must be signed in to change notification settings - Fork 17
/
build.js
46 lines (39 loc) · 864 Bytes
/
build.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
const esbuild = require('esbuild');
const baseConfig = {
entryPoints: ['src/index.ts'],
bundle: true,
logLevel: 'info',
watch: process.argv[2] === '--watch',
};
const umdConfig = {
...baseConfig,
format: 'iife',
// The following are hacks to basically make this an UMD module. No native support for that in esbuild as of today
globalName: 'WebMMuxer',
footer: {
js:
`if (typeof module === "object" && typeof module.exports === "object") Object.assign(module.exports, WebMMuxer)`
}
};
const esmConfig = {
...baseConfig,
format: 'esm'
};
esbuild.build({
...umdConfig,
outfile: 'build/webm-muxer.js'
});
esbuild.build({
...umdConfig,
outfile: 'build/webm-muxer.min.js',
minify: true
});
esbuild.build({
...esmConfig,
outfile: 'build/webm-muxer.mjs'
});
esbuild.build({
...esmConfig,
outfile: 'build/webm-muxer.min.mjs',
minify: true
});