-
Notifications
You must be signed in to change notification settings - Fork 103
/
Copy pathesbuild.mjs
executable file
·41 lines (38 loc) · 997 Bytes
/
esbuild.mjs
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
#!/usr/bin/env node
import { buildSync } from 'esbuild'
// The ES module with only sources bundled (all other packages external).
buildSync({
platform: 'browser',
entryPoints: [
'src/streams/index.ts',
'src/player/index.ts',
'src/overlay/index.ts',
],
outdir: 'dist',
format: 'esm',
packages: 'external',
bundle: true,
minify: true,
sourcemap: true,
splitting: true,
target: 'es2020',
})
// A minified bundle that can be used as-is in browser with e.g.
// <script type="module" src="/msl-streams.min.js"></script>
for (const bundle of [
{ entry: 'src/streams/index.ts', name: 'msl-streams.min.js' },
{ entry: 'src/player/index.ts', name: 'msl-player.min.js' },
{ entry: 'src/overlay/index.ts', name: 'msl-overlay.min.js' },
]) {
buildSync({
platform: 'browser',
entryPoints: [bundle.entry],
outfile: bundle.name,
format: 'esm',
bundle: true,
minify: true,
sourcemap: true,
splitting: false,
target: 'es2020',
})
}