Skip to content

Commit

Permalink
Prevent swallowing webpack warnings on startup
Browse files Browse the repository at this point in the history
  • Loading branch information
Rob McGuinness committed May 17, 2017
1 parent 327b4ca commit 1a2a206
Showing 1 changed file with 31 additions and 14 deletions.
45 changes: 31 additions & 14 deletions packages/availity-workflow/scripts/start.js
Expand Up @@ -118,7 +118,7 @@ function web() {

const percent = Math.round(percentage * 100);

if (previousPercent !== percent && percent % 10 === 0 && msg !== null && msg !== undefined && msg.trim() !== '') {
if (previousPercent !== percent && percent % 10 === 0) {
Logger.info(`${chalk.dim('Webpack')} ${percent}% ${msg}`);
previousPercent = percent;
}
Expand All @@ -143,23 +143,37 @@ function web() {
if (!hasErrors && !hasWarnings) {
openBrowser();
message(stats);
resolve(true);
}

if (hasErrors) {
// https://webpack.js.org/configuration/stats/
const json = stats.toJson({
assets: false,
colors: true,
version: false,
hash: false,
timings: false,
chunks: false,
chunkModules: false,
errorDetails: false
}, true);

const messages = formatWebpackMessages(json);

// https://webpack.js.org/configuration/stats/
const json = stats.toJson({
assets: false,
colors: true,
version: false,
hash: false,
timings: false,
chunks: false,
chunkModules: false,
errorDetails: false
}, true);
if (hasWarnings) {

const messages = formatWebpackMessages(json);
messages.warnings.forEach(warning => {
Logger.empty();
Logger.simple(`${chalk.yellow(warning)}`);
Logger.empty();
});

Logger.failed('Compiled with warnings');
Logger.empty();

}

if (hasErrors) {

messages.errors.forEach(error => {
Logger.empty();
Expand All @@ -170,8 +184,11 @@ function web() {
Logger.failed('Failed compiling');
Logger.empty();
reject(json.errors);
return;
}

resolve();

});

const webpackOptions = {
Expand Down

0 comments on commit 1a2a206

Please sign in to comment.