-
-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathbuild.js
31 lines (28 loc) · 759 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
import esbuild from 'esbuild';
async function buildAll() {
return Promise.all([
build('esm', {
entryPoints: ['src/main.ts', "src/openapi/index.ts"],
format: 'esm',
outdir: './dist/',
bundle: true,
sourcemap: true,
platform: 'node'
}),
build('cjs', {
entryPoints: ['src/main.ts', "src/openapi/index.ts"],
format: 'cjs',
outdir: './dist/cjs',
bundle: true,
sourcemap: true,
platform: 'node'
}),
]);
}
async function build(name, options) {
console.log(`Building ${name}`);
return esbuild.build({
...options,
});
}
buildAll().catch(() => process.exit(1));