-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.js
More file actions
37 lines (31 loc) · 760 Bytes
/
Copy pathbuild.js
File metadata and controls
37 lines (31 loc) · 760 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
33
34
35
36
37
const path = require('path');
const esbuild = require('esbuild');
const { es5Plugin } = require('esbuild-plugin-es5');
function buildEsm() {
const outdir = path.join(__dirname, 'esm');
return esbuild.build({
entryPoints: ['src/**/*'],
bundle: false,
outdir,
target: 'es2016',
format: 'esm',
loader: {}
});
}
function buildMain() {
const outfile = path.join(__dirname, 'dist', 'index.js');
return esbuild.build({
entryPoints: ['src/index.ts'],
bundle: true,
format: "cjs",
plugins: [es5Plugin()],
supported: { destructuring: true },
target: ['chrome58', 'edge16', 'firefox57', 'node12', 'safari11'],
outfile
});
}
async function build() {
await buildEsm();
await buildMain();
}
build();