Skip to content

Conversation

@modax
Copy link

@modax modax commented Jun 9, 2015

This can be done via this.webpackDone in the custom callback. Since original callback needs options and accesses callingDone in the parent context, in my opinion, it is better to be kept as instance method accessible via this.

This can be done via this.webpackDone in the custom callback.
@shama
Copy link
Owner

shama commented Jun 9, 2015

Thanks for the PR! I don't want to take the user's context over though in the done function. I think it would be better just as a separate method:

webpack({}, null, function (err, stats) {
  webpack.logStats(err, stats)
  // Do other stuff
})

@AlbertoElias
Copy link

I think that would be super useful. In my case, I'm trying to get compilation errors in the stats object, and I want to throw an error and stop the compilation if that happens. This is the case if a module is not found, compilation still happens, but webpack outputs the error. It would be great to do something like this inside the done function:

this.emit('error', new gutil.PluginError('webpack-stream', stats.compilation.errors.toString()));

Currently I'm not sure how to stop the stream at that point

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

Successfully merging this pull request may close these issues.

3 participants