Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion packages/gatsby/src/commands/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,8 @@ module.exports = async function build(program: IBuildArgs): Promise<void> {
stats = await buildProductionBundle(program, buildActivityTimer.span)

if (stats.hasWarnings()) {
reportWebpackWarnings(stats.compilation.warnings, report)
const rawMessages = stats.toJson({ moduleTrace: false })
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this restores the object format from webpack 4

reportWebpackWarnings(rawMessages.warnings, report)
}
} catch (err) {
buildActivityTimer.panic(structureWebpackErrors(Stage.BuildJavascript, err))
Expand Down
3 changes: 2 additions & 1 deletion packages/gatsby/src/services/start-webpack-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ export async function startWebpackServer({

if (webpackActivity) {
if (stats.hasWarnings()) {
reportWebpackWarnings(stats.compilation.warnings, report)
const rawMessages = stats.toJson({ moduleTrace: false })
reportWebpackWarnings(rawMessages.warnings, report)
}

if (!isSuccessful) {
Expand Down
4 changes: 2 additions & 2 deletions packages/gatsby/src/utils/webpack-error-utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Reporter } from "gatsby-cli/lib/reporter/reporter"
import { WebpackError, Module, NormalModule } from "webpack"
import { WebpackError, StatsCompilation, Module, NormalModule } from "webpack"
import { Stage as StageEnum } from "../commands/types"
import formatWebpackMessages from "react-dev-utils/formatWebpackMessages"

Expand Down Expand Up @@ -145,7 +145,7 @@ export const structureWebpackErrors = (
}

export const reportWebpackWarnings = (
warnings: Array<WebpackError>,
warnings: StatsCompilation["warnings"] = [],
reporter: Reporter
): void => {
const warningMessages = warnings.map(warning => warning.message)
Expand Down