-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
handle errors/warnings in child compilations
- Loading branch information
1 parent
79140d3
commit 4131c51
Showing
1 changed file
with
17 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 13,21 @@ var WebpackNotifierPlugin = module.exports = function(options) { | |
}; | ||
|
||
WebpackNotifierPlugin.prototype.compileMessage = function(stats) { | ||
function findFirstDFS(compilation, key) { | ||
var match = compilation[key][0]; | ||
if (match) { | ||
return match; | ||
} | ||
|
||
var children = compilation.children; | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
RobertBorg
Author
|
||
for (var i = 0; i < children.length; i) { | ||
match = findFirstDFS(children[i], key); | ||
if (match) { | ||
return match; | ||
} | ||
} | ||
} | ||
|
||
if (this.isFirstBuild) { | ||
this.isFirstBuild = false; | ||
|
||
|
@@ -23,10 38,10 @@ WebpackNotifierPlugin.prototype.compileMessage = function(stats) { | |
|
||
var error; | ||
if (stats.hasErrors()) { | ||
error = stats.compilation.errors[0]; | ||
error = findFirstDFS(stats.compilation, 'errors'); | ||
|
||
} else if (stats.hasWarnings() && !this.options.excludeWarnings) { | ||
error = stats.compilation.warnings[0]; | ||
error = findFirstDFS(stats.compilation, 'warnings'); | ||
|
||
} else if (!this.lastBuildSucceeded || this.options.alwaysNotify) { | ||
this.lastBuildSucceeded = true; | ||
|
@RobertBorg
I cover the plugin with tests
Please tell me the case when the error comes from the child compilation?
Probably some kind of plugin like
extract-text-webpack-plugin
, but I couldn't find a suitable plugin