feat: add support to CommonJS (#519)

* Add support to CommonJS

* Fixes

* Update CHANGELOG.md
This commit is contained in:
Guilherme Werner 2024-01-29 17:55:25 -03:00 committed by GitHub
parent 731f553607
commit 38ddfd61f3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 679 additions and 4 deletions

15
tools/esbuild.js Normal file
View file

@ -0,0 +1,15 @@
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) })