-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.mjs
More file actions
22 lines (19 loc) · 555 Bytes
/
Copy pathbuild.mjs
File metadata and controls
22 lines (19 loc) · 555 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import { build } from 'esbuild';
import pkg from './package.json' assert { type: 'json' };
const formats = [
{ name: 'esm', extension: 'mjs' },
{ name: 'cjs', extension: 'cjs' },
];
/** @type {import('esbuild').BuildOptions} */
const config = {
bundle: true,
minify: true,
sourcemap: true,
target: ['esnext'],
logLevel: 'info',
entryPoints: ['src/index.ts'],
external: Object.keys(pkg.peerDependencies),
};
for (const { name, extension } of formats) {
await build({ ...config, format: name, outfile: `dist/index.${extension}` });
}