Pax:

The fastest JavaScript bundler in the galaxy.

cargo install pax
px --watch index.js bundle.js

Why?

time px index.js bundle.js
real  0m0.015s
user  0m0.006s
sys   0m0.006s

Your bundler is a tool. It’s supposed to help you, not slow you down.

You know the feeling. You make that tweak, hit ⌘S ⌘Tab ⌘R, and… nothing changes. You get the old version. You beat the bundler. You wait a few seconds, hit ⌘R again, and your changes finally show up. But it’s too late—you’ve lost momentum. It’s exactly the wrong shade of pink. You spelled “menu” with a z. The bug still happens sometimes.

Rinse. Repeat. Ten cycles later, things are looking good. It’s time to git commit. But you spent more time waiting than working. And it’s your bundler’s fault.

Pax is a bundler. But you’ll never beat it. Why?

Don’t waste time waiting for your bundler to do its thing. Use Pax while you’re developing, and iterate to your heart’s content. Use your super-cool, magical, slow-as-molasses bundler for releases, when you don’t care how long it takes to run.

How?

cargo install pax
px --watch index.js bundle.js
 ready bundle.js 2ms
update bundle.js 1ms
update bundle.js 1ms
...

Install Pax with Cargo, Rust’s package manager.

Installing Cargo is easy—see rustup.rs for instructions. Once things are set up, try Pax out on a simple project:

index.js
const itt = require('itt')
const math = require('./math')
console.log(itt.range(10).map(math.square).join(' '))
math.js
exports.square = x => x * x
package.json
{
  "dependencies": { "itt": "^0.6.1" }
}
index.html
<!doctype html>
<meta charset=utf-8>
<title>Example</title>
<script src=bundle.js></script>

Tell Pax to generate bundle.js and bundle.js.map, and update whenever a file changes:

px --watch index.js bundle.js

If you want to use ECMAScript module syntax (import/export) in your .mjs files, just pass --es-syntax (-e for short). If you want that in your .js files too, pass --es-syntax-everywhere (-E) instead. If you need anything else, check out the options below. Pax loves you!

Options

px --help
pax v0.4.0

Usage:

px [options] <input> [output]
px [-h | --help | -v | --version]

Options:

-i, --input <input>

Use <input> as the main module.

-o, --output <output>

Write bundle to <output> and source map to <output>.map. Default: '-' for stdout.

-m, --map <map>

Output source map to <map>.

-I, --map-inline

Output source map inline as data: URI.

-M, --no-map

Suppress source map output when it would normally be implied.

-w, --watch

Watch for changes to <input> and its dependencies.

-W, --quiet-watch

Don't emit a bell character for errors that occur while watching. Implies --watch.

-e, --es-syntax

Support .mjs files with ECMAScript module syntax: import itt from 'itt' export const greeting = 'Hello, world!' Instead of CommonJS require syntax: const itt = require('itt') exports.greeting = 'Hello, world!' .mjs (ESM) files can import .js (CJS) files, in which case the namespace object has a single `default` binding which reflects the value of `module.exports`. CJS files can require ESM files, in which case the resultant object is the namespace object.

-E, --es-syntax-everywhere

Implies --es-syntax. Allow ECMAScript module syntax in .js files. CJS-style `require()` calls are also allowed.

-x, --external <module1,module2,...>

Don't resolve or include modules named <module1>, <module2>, etc.; leave them as require('<module>') references in the bundle. Specifying a path instead of a module name does nothing.

--external-core

Ignore references to node.js core modules like 'events' and leave them as require('<module>') references in the bundle.

-h, --help

Print this message.

-v, --version

Print version information.