-
Notifications
You must be signed in to change notification settings - Fork 5
/
esbuild.js
34 lines (31 loc) · 833 Bytes
/
esbuild.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
32
33
34
const esbuild = require('esbuild');
const __DEV__ = process.env.NODE_ENV === 'development';
const __PROD__ = process.env.NODE_ENV === 'production';
// ESM - Currently disabled as CommonJS named exports seem to work pretty well with ESM based imports
/*esbuild
.build({
entryPoints: ['src/index.ts'],
outdir: 'dist',
bundle: true,
sourcemap: true,
minify: true,
splitting: true,
format: 'esm',
target: ['esnext']
})
.catch(() => process.exit(1));*/
// CJS
esbuild
.build({
entryPoints: ['src/index.ts'],
outfile: 'dist/index.js',
format: 'cjs',
bundle: true,
sourcemap: __DEV__,
minify: __PROD__,
platform: 'node',
// ????
// there's no node14.X option https://esbuild.github.io/api/#target
target: ['node14.16']
})
.catch(() => process.exit(1));