asterjs / aster-commonjs

Bundle CommonJS with aster

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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',
  output: 'dist/bundle.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

About

Bundle CommonJS with aster

License:MIT License


Languages

Language:JavaScript 100.0%