Skip to content
This repository has been archived by the owner on May 1, 2020. It is now read-only.

Commit

Permalink
feature(webpack): Propagate errors from webpack stats (#871)
Browse files Browse the repository at this point in the history
* Propagate errors from webpack stats

Prior to this patch, the script would only raise errors raised directly
by webpack and skip errors raised from the compilation. This is contrary
to what webpack suggests in terms of error handling[1].

This patch makes it so that any compilation errors will cause ionic to
also abort the build, while any compilation warnings will log a warning
through ionic's Logger.

* Update webpack.ts
  • Loading branch information
abomadi authored and danbucholtz committed Apr 21, 2017
1 parent 547dc65 commit fa5e52c
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/webpack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,20 @@ export function runWebpackFullBuild(config: WebpackConfig) {
const callback = (err: Error, stats: any) => {
if (err) {
reject(new BuildError(err));
} else {
resolve(stats);
}
else {
const info = stats.toJson();

if (stats.hasErrors()) {
reject(new BuildError(info.errors));
}
else if (stats.hasWarnings()) {
Logger.debug(info.warnings)
resolve(stats);
}
else {
resolve(stats);
}
}
};
const compiler = webpackApi(config);
Expand Down

0 comments on commit fa5e52c

Please sign in to comment.