node-gamedig/tools/esbuild.js
Guilherme Werner 38ddfd61f3
feat: add support to CommonJS (#519)
* Add support to CommonJS

* Fixes

* Update CHANGELOG.md
2024-01-29 22:55:25 +02:00

16 lines
473 B
JavaScript

import { build } from 'esbuild'
import { nodeExternalsPlugin } from 'esbuild-node-externals'
const buildConfig = {
entryPoints: ['lib/index.js'],
platform: 'node',
target: 'node16',
bundle: true,
outfile: 'dist/index.cjs',
format: 'cjs',
// got is a esm module, so we need to add it to the allowList, to include it in the bundle.
plugins: [nodeExternalsPlugin({ allowList: ['got'] })]
}
build(buildConfig).then(() => { }).catch(() => { process.exit(1) })