From 7fcfe3df4949e0f5d2f8e653bc138a4561af48eb Mon Sep 17 00:00:00 2001 From: Kyle Mathews Date: Tue, 19 Oct 2021 06:19:02 -0700 Subject: [PATCH] fix(gatsby): restore onPreBuild to being called right after bootstrap finishes (#33591) * fix(gatsby): restore onPreBuild to being called right after bootstrap finishes Somehow it drifted down in the build where it's supposed to be the first API called after bootstrap finishes https://www.gatsbyjs.com/docs/reference/config-files/gatsby-node/#onPreBuild * chore: format Co-authored-by: gatsbybot --- packages/gatsby/src/commands/build.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/gatsby/src/commands/build.ts b/packages/gatsby/src/commands/build.ts index bb51593db2a10..3e5dfca447c7d 100644 --- a/packages/gatsby/src/commands/build.ts +++ b/packages/gatsby/src/commands/build.ts @@ -107,6 +107,11 @@ module.exports = async function build(program: IBuildArgs): Promise { parentSpan: buildSpan, }) + await apiRunnerNode(`onPreBuild`, { + graphql: gatsbyNodeGraphQLFunction, + parentSpan: buildSpan, + }) + // writes sync and async require files to disk // used inside routing "html" + "javascript" await writeOutRequires({ @@ -292,11 +297,6 @@ module.exports = async function build(program: IBuildArgs): Promise { }) } - await apiRunnerNode(`onPreBuild`, { - graphql: gatsbyNodeGraphQLFunction, - parentSpan: buildSpan, - }) - // Copy files from the static directory to // an equivalent static directory within public. copyStaticDirs()