Closed nkzawa closed 8 years ago
I've run into the same problem. Especially annoying since the gulp docs rave about this solution
Same here...
I got the same problem.
Can be resolved by https://github.com/substack/node-browserify/issues/1198
vote / +1 / :+1:
Please refer to substack/node-browserify#1191 substack/node-browserify#1044
+1 substack/node-browserify#1198 does not work for me:
...\node_modules\vinyl-fs\node_modules\vinyl\index.js:143 throw new Error('File.contents can only be a Buffer, a Stream, or null.');
Edit: This solution works fine for me (removed the watchify part): https://gist.github.com/Sigmus/9253068
Code:
var jsDir, jsDest; //source dir, destination dir, see link for other definitions
function buildScript(file) {
var props = {entries: [jsDir + file], debug: true};
var bundler = browserify(props);
var stream = bundler.bundle();
return stream.on('error', handleErrors)
.pipe(source(file))
.pipe(gulp.dest(jsDest));
}
gulp.task('build-js', function () {
return buildScript('toplevelscript.js');
});
Same issue. I prefer vinyl-transform over vinyl-source-stream because I don't have to put it at the beginning of my pipeline, I can start my pipeline with gulp.src() and pass that stuff to browserify further down the pipeline.
+1
+1
+1
+1
+1
+1
+1
+1
The recommendations made in the gulp docs are out of my hands, vinyl-source-stream
is the most appropriate solution here. I know it feels consistent using vinyl-transform
, but it's mostly aesthetic preferences at that point. If you'd really like to fix this, please open an issue for browserify and/or gulp — there's nothing that vinyl-transform
can do about it sadly.
browserify().bundle()
returns a readable stream from v9.0.6, thus the following recipe doesn't work now. I'm not sure whether this issue is what this library should support though.https://github.com/substack/node-browserify/commit/f714ac15461db8c7fb9a53b6aad0441c1dbe9c6b