-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.js
27 lines (24 loc) · 802 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
import { build } from 'esbuild';
import { nodeExternalsPlugin } from 'esbuild-node-externals';
build({
entryPoints: ['src/index.ts'],
bundle: true,
platform: 'node',
outfile: 'dist/index.mjs',
format: 'esm',
target: 'es2020',
sourcemap: true,
plugins: [nodeExternalsPlugin()],
});
build({
entryPoints: ['src/index.ts'],
bundle: true,
platform: 'node',
outfile: 'dist/index.cjs',
format: 'cjs',
target: 'es2016',
sourcemap: true,
plugins: [nodeExternalsPlugin()],
});
// esbuild src/index.ts --outfile=dist/index.mjs --format=esm --bundle --target=es2020 --external:node_modules/* --platform=node --sourcemap",
// "build:cjs": "esbuild src/index.ts --outfile=dist/index.cjs --format=cjs --bundle --target=es2016 --external:node_modules/* --platform=node --sourcemap",