Skip to content

Instantly share code, notes, and snippets.

@xc2
Last active March 5, 2021 14:14
Show Gist options
  • Save xc2/2c6b8b8da576fbb613450a675fdb6329 to your computer and use it in GitHub Desktop.
Save xc2/2c6b8b8da576fbb613450a675fdb6329 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
args="--bundle --format=cjs --platform=node --target=node10 --charset=utf8 --minify"
pkg=$(node -p 'const pkg=require("./package.json");`${pkg.name}@${pkg.version}`')
banner="/**
* bundle ${pkg} with esbuild@$(esbuild --version) with args
* ${args}
* bundle script: https://gist.github.com/xc2/2c6b8b8da576fbb613450a675fdb6329
*/"
esbuild $args --outfile=${pkg}.js --banner="$banner" .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment