I've seen a lot of disparate answers to similar issues, and I've tried a whole bunch of them. I've tried using gulp-streamify, and vinyl-buffer, I've tried using it without anything, but no matter what I do I get an error with Uglify whenever I include it in my gulp pipeline.
The following is the most relevant snippet of my code.
var bfyBundler = browserify({
entries:['./src/sequencer.js'],
extensions:['.jsx'],
debug: devMode,
cache: {}, packageCache: {}, fullPaths: true
});
function bundleSequencer(){
var pipeline = bfyBundler.bundle()
.on('error', function(error){
notifier.notify({
title:error.description,
message:error.message,
sound:true,
wait:true,
fileAndLocation:error.filename + ':' + error.lineNumber + ':' + error.column
});
});
if(!devMode){
pipeline = pipeline
.pipe(uglify());
}
pipeline = pipeline
.pipe(source('sequencer.js'))
.pipe(gulp.dest('./app/'));
}
However running this pipeline returns the following error:
E:\Sequencer\node_modules\gulp-uglify\minifier.js:67
if (file.isNull()) {
^
TypeError: file.isNull is not a function
at DestroyableTransform.minify [as _transform] (E:\Sequencer\node_modules\gulp-uglify\minifier.js:67:14)
at DestroyableTransform.Transform._read (E:\Sequencer\node_modules\through2\node_modules\readable-stream\lib\_stream_transform.js:172:10)
at DestroyableTransform.Transform._write (E:\Sequencer\node_modules\through2\node_modules\readable-stream\lib\_stream_transform.js:160:12)
at doWrite (E:\Sequencer\node_modules\through2\node_modules\readable-stream\lib\_stream_writable.js:326:12)
at writeOrBuffer (E:\Sequencer\node_modules\through2\node_modules\readable-stream\lib\_stream_writable.js:312:5)
at DestroyableTransform.Writable.write (E:\Sequencer\node_modules\through2\node_modules\readable-stream\lib\_stream_writable.js:239:11)
at Readable.ondata (E:\Sequencer\node_modules\readable-stream\lib\_stream_readable.js:572:20)
at emitOne (events.js:77:13)
at Readable.emit (events.js:169:7)
at readableAddChunk (E:\Sequencer\node_modules\readable-stream\lib\_stream_readable.js:195:16)
Using node-debug to trigger gulp it seems like gulp is passing in a Buffer object as opposed to a Vinyl file to Uglify. I welcome any input or methods that I can try to diagnose this issue.
I am using node v4.1.2 and gulp v3.9.0. So far as I can tell these are the latest versions. I'm wondering if something changed?
I've also posted this question to IRC, and hope for a quick resolution.