Skip to content

Commit f4a2862

Browse files
graingertkamilogorek
authored andcommitted
build: Fix browserify plugin transform append (#1229)
1 parent dd5a3bc commit f4a2862

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

Gruntfile.js

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,10 @@ module.exports = function(grunt) {
2424
// custom browserify transformer to re-write plugins to
2525
// self-register with Raven via addPlugin
2626
function AddPluginBrowserifyTransformer() {
27+
var noop = function (chunk, _, cb) { cb(null, chunk); };
28+
var append = function (cb) { cb(null, "\nrequire('../src/singleton').addPlugin(module.exports);"); };
2729
return function(file) {
28-
return through(function(buf, enc, next) {
29-
buf = buf.toString('utf8');
30-
if (/plugins/.test(file)) {
31-
buf += "\nrequire('../src/singleton').addPlugin(module.exports);";
32-
}
33-
this.push(buf);
34-
next();
35-
});
30+
return through(noop, /plugins/.test(file) ? append : undefined);
3631
};
3732
}
3833

0 commit comments

Comments
 (0)