bundle-through v1.0.3
Bundle CommonJS scripts through vinyl stream, using browserify.
Install
npm install bundle-through
Usage
const bundler = const gulp = gulp
This bundles all CommonJS scripts (require
/ module.exports
) through the stream. Each entry in the stream is considered as the only entrypoint of the bundle.
Add transform
bundle-through
takes arguments and they are passed to browserify. For example, you can pass transform
option to add the transforms.
gulp
Add sourcemap
Set sourcemaps
option true
and write sourcemaps using gulp-sourcemaps
.
const sourcemaps = gulp
API Reference
const bundler = require('bundle-through')
bundler(options)
- @param {boolean} buffer
true
iff you want output file to have buffer type contents. Default istrue
. If setfalse
, the output file has file contents as a stream. - @param {boolean} sourcemaps
true
iff you want to output sourcemaps. You need to write it usinggulp-sourcemaps
. - These options are directly passed to
browserify
. See the documents for details. - @return {Transform<Vinyl, Vinyl>}
This returns Transform stream of the object mode which transform CommonJS scripts into the bundle using browserify. Each entry in the stream is considered as the only entrypoint of the bundle and therefore input and output files has the 1-to-1 relationship.
License
MIT