Why not Babel?

People always get really enthusiastic about babel.

I get it. Using all of ES6 plus whatever stuff you want to throw at it is cool.

However, consider this:

:; npm i string-tokenize
+ string-tokenize@0.0.6
added 61 packages in 5.212s

:; npm ls
t@1.0.0 /Users/aredridel/Projects/t
└─┬ string-tokenize@0.0.6
├─┬ babel-plugin-transform-object-rest-spread@6.26.0
│ ├── babel-plugin-syntax-object-rest-spread@6.13.0
│ └─┬ babel-runtime@6.26.0
│ ├── core-js@2.5.1 deduped
│ └── regenerator-runtime@0.11.0
├─┬ babel-polyfill@6.26.0
│ ├── babel-runtime@6.26.0 deduped
│ ├── core-js@2.5.1
│ └── regenerator-runtime@0.10.5
├─┬ babel-register@6.26.0
│ ├─┬ babel-core@6.26.0
│ │ ├─┬ babel-code-frame@6.26.0
│ │ │ ├─┬ chalk@1.1.3
│ │ │ │ ├── ansi-styles@2.2.1
│ │ │ │ ├── escape-string-regexp@1.0.5
│ │ │ │ ├─┬ has-ansi@2.0.0
│ │ │ │ │ └── ansi-regex@2.1.1
│ │ │ │ ├─┬ strip-ansi@3.0.1
│ │ │ │ │ └── ansi-regex@2.1.1 deduped
│ │ │ │ └── supports-color@2.0.0
│ │ │ ├── esutils@2.0.2
│ │ │ └── js-tokens@3.0.2
│ │ ├─┬ babel-generator@6.26.0
│ │ │ ├── babel-messages@6.23.0 deduped
│ │ │ ├── babel-runtime@6.26.0 deduped
│ │ │ ├── babel-types@6.26.0 deduped
│ │ │ ├─┬ detect-indent@4.0.0
│ │ │ │ └─┬ repeating@2.0.1
│ │ │ │ └─┬ is-finite@1.0.2
│ │ │ │ └── number-is-nan@1.0.1
│ │ │ ├── jsesc@1.3.0
│ │ │ ├── lodash@4.17.4 deduped
│ │ │ ├── source-map@0.5.7 deduped
│ │ │ └── trim-right@1.0.1
│ │ ├─┬ babel-helpers@6.24.1
│ │ │ ├── babel-runtime@6.26.0 deduped
│ │ │ └── babel-template@6.26.0 deduped
│ │ ├─┬ babel-messages@6.23.0
│ │ │ └── babel-runtime@6.26.0 deduped
│ │ ├── babel-register@6.26.0 deduped
│ │ ├── babel-runtime@6.26.0 deduped
│ │ ├─┬ babel-template@6.26.0
│ │ │ ├── babel-runtime@6.26.0 deduped
│ │ │ ├── babel-traverse@6.26.0 deduped
│ │ │ ├── babel-types@6.26.0 deduped
│ │ │ ├── babylon@6.18.0 deduped
│ │ │ └── lodash@4.17.4 deduped
│ │ ├─┬ babel-traverse@6.26.0
│ │ │ ├── babel-code-frame@6.26.0 deduped
│ │ │ ├── babel-messages@6.23.0 deduped
│ │ │ ├── babel-runtime@6.26.0 deduped
│ │ │ ├── babel-types@6.26.0 deduped
│ │ │ ├── babylon@6.18.0 deduped
│ │ │ ├── debug@2.6.9 deduped
│ │ │ ├── globals@9.18.0
│ │ │ ├─┬ invariant@2.2.2
│ │ │ │ └─┬ loose-envify@1.3.1
│ │ │ │ └── js-tokens@3.0.2 deduped
│ │ │ └── lodash@4.17.4 deduped
│ │ ├─┬ babel-types@6.26.0
│ │ │ ├── babel-runtime@6.26.0 deduped
│ │ │ ├── esutils@2.0.2 deduped
│ │ │ ├── lodash@4.17.4 deduped
│ │ │ └── to-fast-properties@1.0.3
│ │ ├── babylon@6.18.0
│ │ ├── convert-source-map@1.5.1
│ │ ├─┬ debug@2.6.9
│ │ │ └── ms@2.0.0
│ │ ├── json5@0.5.1
│ │ ├── lodash@4.17.4 deduped
│ │ ├─┬ minimatch@3.0.4
│ │ │ └─┬ brace-expansion@1.1.8
│ │ │ ├── balanced-match@1.0.0
│ │ │ └── concat-map@0.0.1
│ │ ├── path-is-absolute@1.0.1
│ │ ├── private@0.1.8
│ │ ├── slash@1.0.0
│ │ └── source-map@0.5.7 deduped
│ ├── babel-runtime@6.26.0 deduped
│ ├── core-js@2.5.1 deduped
│ ├─┬ home-or-tmp@2.0.0
│ │ ├── os-homedir@1.0.2
│ │ └── os-tmpdir@1.0.2
│ ├── lodash@4.17.4
│ ├─┬ mkdirp@0.5.1
│ │ └── minimist@0.0.8
│ └── source-map-support@0.4.18 deduped
├─┬ chai@3.5.0
│ ├── assertion-error@1.0.2
│ ├─┬ deep-eql@0.1.3
│ │ └── type-detect@0.1.1
│ └── type-detect@1.0.0
└─┬ source-map-support@0.4.18
└── source-map@0.5.7

:; npm rm string-tokenize
removed 61 packages in 1.356s

:; npm i @aredridel/string-tokenize
+ @aredridel/string-tokenize@1.0.0
added 1 package in 1.317s

:; npm ls
t@1.0.0 /Users/aredridel/Projects/t
└── @aredridel/string-tokenize@1.0.0

This is roughly the same code. I ported it to not be written using ES6 Modules, used core node assert instead of chai (It has the same functionality being used!), and removed Flow type annotations. It works in node 8 easily, and should work in node 4.

I work in constrained environments: page load time is very important to me. If I’m loading even a fraction of this in a browser, I’ve blown my budget. I run a bunch of hobby projects on a very inexpensive server. RAM is at a premium. All of these things have costs.