Skip to content

Commit

Permalink
Fixed bug where transforms array grew on each call to bundle()
Browse files Browse the repository at this point in the history
  • Loading branch information
bclinkinbeard committed Apr 2, 2014
1 parent ffc67e3 commit 932154e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,14 @@ module.exports = function (opts, cb) {
b.add(path.resolve(process.cwd(), entry))
})

// Browserify modifies the transforms property once opts is passed in to bundle()
// so we copy that prop here to ensure we only use what is passed in from config
if (!opts._transforms) {
opts._transforms = opts.transforms ? opts.transforms.slice(0) : []
}

// ensure brfs runs last because it requires valid js
var transforms = [envify, ejsify, hbsfy, jadeify, partialify].concat(opts.transforms || []).concat([brfs])
var transforms = [envify, ejsify, hbsfy, jadeify, partialify].concat(opts._transforms).concat([brfs])
transforms.forEach(function (transform) {
if (Array.isArray(transform)) {
b.transform(transform[1], transform[0])
Expand Down

0 comments on commit 932154e

Please sign in to comment.