Bundle CommonJS with aster.
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);
-
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"
).