Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Error: write after end" when using babelify with gulp #46

Closed
Problematic opened this issue Feb 22, 2015 · 2 comments
Closed

"Error: write after end" when using babelify with gulp #46

Problematic opened this issue Feb 22, 2015 · 2 comments

Comments

@Problematic
Copy link

In my gulpfile, I have a preprocessing task like so:

var gulp = require('gulp');
var transform = require('vinyl-transform');
var browserify = require('browserify');
gulp.task('preprocess:js', function () {
    return gulp.src(['./src/js/index.js'])
        .pipe(transform(function (filename) {
            return browserify()
                .transform(require('babelify'))
                .require(filename, { entry: true })
                .bundle();
        }))
        .pipe(gulp.dest('./dist/js'));
});

Running the task, I get the following stack trace:

Error: write after end
    at writeAfterEnd (/Users/problematic/dev/node_modules/browserify/node_modules/readable-stream/lib/_stream_writable.js:161:12)
    at Labeled.Writable.write (/Users/problematic/dev/node_modules/browserify/node_modules/readable-stream/lib/_stream_writable.js:208:5)
    at write (_stream_readable.js:602:24)
    at flow (_stream_readable.js:611:7)
    at _stream_readable.js:579:7
    at process._tickCallback (node.js:442:13)

This error disappears if I comment out the transform(require('babelify') line of the task.

@sebmck
Copy link

sebmck commented Feb 22, 2015

Looks like it's due to vinyl-transform. Quick search shows that it's an issue a lot of people run into when using it, browserify/browserify#1044. The suggestion here might work.

@Problematic
Copy link
Author

That did the trick; thanks much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants