babel-nodepack

1.0.0 • Public • Published

babel-nodepack

NPM version Build status Test coverage Dependency Status License Downloads

A bundler for node.js projects using babel. Compiles all your local files into a single script suitable for node.js usage. This differs from webpack/browserify in that:

  • It's much simpler
  • Only uses babel
  • Does not parse node_modules - it assumes modules will still be available
  • Only supports CommonJS build outputs

Features

  • Automatically caches builds to the local file system.

Caveats

  • __dirname and __filename are not supported
  • Dynamic requires like require('./' + 'file') are not supported

API

nodepack(options).then(result => )

Returns:

  • result.tree - the dependency tree as an array
  • result.code - the JS code bundled together

Options:

  • filename - entry file
  • hash - hash for the entire build for testing. This should primarily be based on babel configs.
  • presets - an array of babel presets to use.
  • plugins - an array of babel plugins to use.

nodepack.cache.CACHE_DIR

The location of the cache directory. You could also set it via BABEL_NODEPACK_CACHE_DIR=.

nodepack.cache.rimraf().then(() => )

Clear the nodepack cache folder.

nodepack.cache.mkdirp().then(() => )

Make sure the nodepack cache folder exists.

Readme

Keywords

Package Sidebar

Install

npm i babel-nodepack

Weekly Downloads

1

Version

1.0.0

License

MIT

Last publish

Collaborators

  • jongleberry