Gzip and Brotli compression for esbuild.
$ npm i -D esbuild @luncheon/esbuild-plugin-gzip
const esbuild = require('esbuild')
const gzipPlugin = require('@luncheon/esbuild-plugin-gzip')
esbuild.build({
entryPoints: ['src/app.ts'],
outdir: 'dist',
bundle: true,
minify: true,
write: false, // write must be false
plugins: [gzipPlugin()],
})
gzipPlugin({
uncompressed: true,
gzip: true,
brotli: true,
onEnd: ({ outputFiles }) => {
// outputFiles.forEach(({ path, contents }) => {})
}
})