Skip to content

Commit 0586b2d

Browse files
committed
fix(gatsby-cli): relax error location validation and ignore extra fields
1 parent 135e080 commit 0586b2d

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

packages/gatsby-cli/src/structured-errors/error-schema.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export const errorSchema: Joi.ObjectSchema<IStructuredError> =
2727
location: Joi.object({
2828
start: Position.required(),
2929
end: Position,
30-
}),
30+
}).unknown(),
3131
docsUrl: Joi.string().uri({
3232
allowRelative: false,
3333
relativeOnly: false,

packages/gatsby/src/utils/webpack-error-utils.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,10 @@ const transformWebpackError = (
6464

6565
if (!location && castedWebpackError.error?.loc) {
6666
if (castedWebpackError.error.loc.start) {
67-
location = castedWebpackError.error.loc
67+
location = {
68+
start: castedWebpackError.error.loc.start,
69+
end: castedWebpackError.error.loc.end,
70+
}
6871
} else {
6972
location = {
7073
start: castedWebpackError.error.loc,

0 commit comments

Comments
 (0)