0.1.0 • Published 10 years ago

aster-commonjs v0.1.0

Weekly downloads
2
License
MIT
Repository
github
Last release
10 years ago

aster-commonjs

NPM version Build Status

Bundle CommonJS with aster.

Usage

First, install aster-commonjs as a development dependency:

npm install --save-dev aster-commonjs

Then, add it to your build script:

var aster = require('aster');
var commonjs = require('aster-commonjs');

aster.src('src/**/*.js')
.map(commonjs({
  input: 'src/index.js'
}))
.map(aster.dest('dist'))
.subscribe(aster.runner);

API

commonjs(options)

  • input: String | Function(). Input file. Example: 'superLib/topModule.js'

  • output: String | Function(input) Output file. Default: input => input.replace(/(\.js)?$/, '.out.js')

  • external: { cjsName: (true | { amd?: String, global?: String }) } External dependencies (to be excluded from bundling). Example:

    {
      jquery: true,
      lodash: {amd: '../vendor/lodash.js', global: '_'}
    }
  • exports: String | Function(input, output) Export top module with UMD with given global object name. Default: no exports.

  • defaultExt: String Default extension for require calls ("js").

License

MIT License