Skip to content

Instantly share code, notes, and snippets.

@chientrm
Created June 17, 2022 12:15
Show Gist options
  • Save chientrm/034789e613569ce2924f9c08714f46e7 to your computer and use it in GitHub Desktop.
Save chientrm/034789e613569ce2924f9c08714f46e7 to your computer and use it in GitHub Desktop.
import { build } from 'esbuild';
build({
entryPoints: ['./index.js'],
bundle: true,
minify: true,
outfile: './build/index.js',
format: 'esm',
platform: 'node',
external: ['./handler.js'],
banner: {
js: "import { createRequire } from 'module';const require = createRequire(import.meta.url);"
}
}).catch((err) => {
process.stderr.write(err.stderr);
process.exit(1);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment