Skip to content

Commit

Permalink
docs: add esbuild bundling guide (#2075)
Browse files Browse the repository at this point in the history
  • Loading branch information
hardfist committed Nov 26, 2021
1 parent 95a387e commit 6a464b3
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions docs/bundling.md
Expand Up @@ -66,3 +66,21 @@ In a new project (see: [npm-init](https://docs.npmjs.com/cli/v7/commands/npm-ini
```
4. Run: `npx webpack@5 --config webpack.config.js`.
5. You can now execute `dist/bundle.js`.

## esbuild
The following is tested with esbuild@0.13
In a new project (see: [npm-init](https://docs.npmjs.com/cli/v7/commands/npm-init)):
1. `npm install esbuild yargs`
2. Create the following **index.js**
```js
const yargs = require('yargs')
const argv = yargs(process.argv).argv

if (argv.ships > 3 && argv.distance < 53.5) {
console.log('Plunder more riffiwobbles!')
} else {
console.log('Retreat from the xupptumblers!')
}
```
3. Runt `npx esbuild index.js --bundle --outfile=bundle.js --platform=node --target=node12`
4. You can now execute `node bundle.js`.

0 comments on commit 6a464b3

Please sign in to comment.