-
Notifications
You must be signed in to change notification settings - Fork 16
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
resume bundleStream after attaching cache hooks #8
base: master
Are you sure you want to change the base?
Conversation
Just to add a little bit of context: I'm trying to use browserify-incremental with karma-browserify which passes a callback to the if (cb) {
output.on('error', cb);
output.pipe(concat(function (body) {
cb(null, body);
}));
} And this messes up the |
I would like to reproduce the issue you're having and make a test for it, but I can't reproduce it. I don't run into any problems when passing a callback to the bundle method. package.json {
"name": "foo",
"version": "1.0.0",
"dependencies": {
"browserify": "^13.0.0",
"browserify-incremental": "^3.1.1"
},
"license": "ISC"
} test.js var path = require('path');
var browserify = require('browserify-incremental'),
b = browserify({cacheFile: path.join(__dirname, 'browserify-cache.json')})
.require('./foo.js');
b.bundle(function() {
console.log('bundle callback');
}); foo.js console.log('foo');
|
Indeed it works... I don't understand. Must be something to do with karma-browserify then. I'll need to take a closer look tomorrow morning. |
What if instead of |
Bump. |
I haven't been able to reproduce the issue. Could you make an example repository and give the commands necessary to reproduce it? |
I have asked a friend to test it on Windows. Same issue. Perhaps it's an asynchronicity problem, because it works well on small files. |
Thanks for the reproduction case! (Note: you should use npm-shrinkwrap for this sort of thing.) I can verify it fails for me. Before merging this, I would prefer to have a test for it, and to investigate whether this might actually be a Browserify bug. I haven't looked into it yet after getting this reproduction case but I'm not sure how browserify-cache-api could be doing something differently when React is imported. |
80ef187
to
7946e50
Compare
Sorry for the late reply, vacation time ^_^'.
Unlikely, because running the same code using Browserify works.
Any dependency that requires a lot of files (like By default streams are created with |
+1 |
I investigated this bug with @olegskl. To complete his answer, when the stream created by browserify gets paused because of output stream buffer overflow, chunks will no longer leave the internal buffer of browserify stream (more details here). Because of this, the concat stream that should execute the callback will no longer receive any event and therefore can't call the callback on finish. Also the buffer of output stream that you create is 2 times the size of the |
I'm also dealing with this bug. Would be cool if we got the fix :) |
I can also confirm that this fix works btw. |
When callback is provided to the original bundle, the
'end'
event is never fired. Proposal to add a.resume()
to the stream.