-
-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy path.esbuild.js
More file actions
32 lines (26 loc) · 676 Bytes
/
Copy path.esbuild.js
File metadata and controls
32 lines (26 loc) · 676 Bytes
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
import { build } from 'esbuild'
const NODE_BUILTINS = ['fs', 'fs/promises', 'url']
// WASM codec packages — loaded on demand by audio-decode / encode-audio
const CODECS = [
'@audio/decode-*', '@audio/encode-*',
]
const base = {
entryPoints: ['audio.js'],
bundle: true,
format: 'esm',
platform: 'browser',
}
// dist/audio.js — core + dispatch, codecs load on demand via import()
await build({
...base,
outfile: 'dist/audio.js',
external: [...NODE_BUILTINS, ...CODECS],
})
// dist/audio.min.js — same, minified
await build({
...base,
outfile: 'dist/audio.min.js',
external: [...NODE_BUILTINS, ...CODECS],
minify: true,
})
console.log('done')