-
Notifications
You must be signed in to change notification settings - Fork 2
/
esbuild.js
48 lines (46 loc) · 1.09 KB
/
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import esbuild from 'esbuild'
import { clean } from 'esbuild-plugin-clean'
import copyFilePlugin from 'esbuild-plugin-copy-file'
import fileloc from 'esbuild-plugin-fileloc'
const banner = `#!/usr/bin/env node
import {createRequire} from 'module';
const require = createRequire(import.meta.url);
`
esbuild
.build({
entryPoints: ['./src/index.ts', './src/args.ts', './src/blocks.ts', './src/config.ts'],
platform: 'node',
target: 'node16',
bundle: true,
plugins: [
clean({
patterns: ['./dist/*']
}),
fileloc.filelocPlugin(),
copyFilePlugin({
after: {
'./dist/package.json': './package.json',
'./dist/README.md': './README.md',
'./dist/LICENSE.txt': './LICENSE.txt'
}
})
],
loader: {
'.ts': 'ts',
'.js': 'js',
'.cjs': 'js',
'.yml': 'text'
},
outdir: 'dist',
external: ['package.json'],
minify: true,
sourcemap: false,
format: 'esm',
banner: {
js: banner
}
})
.catch(error => {
console.error(error.message)
process.exit(1)
})