diff --git a/packages/gatsby-cli/src/structured-errors/error-schema.ts b/packages/gatsby-cli/src/structured-errors/error-schema.ts index 306da6d31bdee..d018c061e91c8 100644 --- a/packages/gatsby-cli/src/structured-errors/error-schema.ts +++ b/packages/gatsby-cli/src/structured-errors/error-schema.ts @@ -27,7 +27,7 @@ export const errorSchema: Joi.ObjectSchema = location: Joi.object({ start: Position.required(), end: Position, - }), + }).unknown(), docsUrl: Joi.string().uri({ allowRelative: false, relativeOnly: false, diff --git a/packages/gatsby/src/utils/webpack-error-utils.ts b/packages/gatsby/src/utils/webpack-error-utils.ts index ac16ce191921a..9ae9d58994ec1 100644 --- a/packages/gatsby/src/utils/webpack-error-utils.ts +++ b/packages/gatsby/src/utils/webpack-error-utils.ts @@ -64,7 +64,10 @@ const transformWebpackError = ( if (!location && castedWebpackError.error?.loc) { if (castedWebpackError.error.loc.start) { - location = castedWebpackError.error.loc + location = { + start: castedWebpackError.error.loc.start, + end: castedWebpackError.error.loc.end, + } } else { location = { start: castedWebpackError.error.loc,