diff --git a/packages/gatsby/src/internal-plugins/functions/gatsby-node.ts b/packages/gatsby/src/internal-plugins/functions/gatsby-node.ts index 7c11342c90888..ca5506df6906d 100644 --- a/packages/gatsby/src/internal-plugins/functions/gatsby-node.ts +++ b/packages/gatsby/src/internal-plugins/functions/gatsby-node.ts @@ -220,7 +220,7 @@ export async function onPreBootstrap({ function callback(err, stats): any { const rawMessages = stats.toJson({ moduleTrace: false }) if (rawMessages.warnings.length > 0) { - reporter.warn(reportWebpackWarnings(rawMessages.warnings)) + reportWebpackWarnings(rawMessages.warnings, reporter) } if (err) return reject(err) diff --git a/packages/gatsby/src/utils/webpack-error-utils.ts b/packages/gatsby/src/utils/webpack-error-utils.ts index c01d5b9aef7bb..6c00bae073297 100644 --- a/packages/gatsby/src/utils/webpack-error-utils.ts +++ b/packages/gatsby/src/utils/webpack-error-utils.ts @@ -148,7 +148,9 @@ export const reportWebpackWarnings = ( warnings: StatsCompilation["warnings"] = [], reporter: Reporter ): void => { - const warningMessages = warnings.map(warning => warning.message) + const warningMessages = warnings.map( + warning => `${warning.moduleName}\n\n${warning.message}` + ) formatWebpackMessages({ errors: [],