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
Fix race condition #23
Conversation
fs.writeFile(cssOutFilename, css, function(err) { | ||
if (err) console.error(err); | ||
fs.writeFile(cssOutFilename, css, function () { | ||
cb.apply(null, args); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good one, thanks. Could you please update so that cb
only gets called if it exists?
10a5952
to
074fc05
Compare
Two things: 1) Reverting back to browserify's original bundle method. This method is only intended to take a singular callback argument. 2) stream.on('end', function () {}) creates a race condition. Using a callback in the bundle method instead to resolve this.
@joshwnj updated to check if |
Thanks! |
@tedbreen are you using css-modulesify in production? At some point we'll want to get this to v1.0 so will be good to know who is using it and how :) |
leaving a note here for future reference: I had to upgrade browserify to v11 with this version as v10 was having issues. |
cool! |
Two things:
bundle
method. This method is only intended to take a singular argument (a callback in this case).stream.on('end', function () {})
creates a race condition. Using a callback in the bundle method instead to resolve this.