Skip to content

asterjs/aster-commonjs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published