From e39f6cd636b83c65d01685fe2cd184af99772f33 Mon Sep 17 00:00:00 2001 From: GatsbyJS Bot Date: Tue, 25 Jan 2022 05:17:02 -0700 Subject: [PATCH] fix(gatsby): don't remove onPluginInit in graphql-engine (#34558) (#34586) Co-authored-by: Michal Piechowiak --- .../src/schema/graphql-engine/webpack-remove-apis-loader.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/gatsby/src/schema/graphql-engine/webpack-remove-apis-loader.ts b/packages/gatsby/src/schema/graphql-engine/webpack-remove-apis-loader.ts index 638ece7fe78c3..148866cc0ad47 100644 --- a/packages/gatsby/src/schema/graphql-engine/webpack-remove-apis-loader.ts +++ b/packages/gatsby/src/schema/graphql-engine/webpack-remove-apis-loader.ts @@ -3,6 +3,9 @@ import { GatsbyNodeAPI } from "../../redux/types" import * as nodeApis from "../../utils/api-node-docs" import { schemaCustomizationAPIs } from "./print-plugins" +const apisToKeep = new Set(schemaCustomizationAPIs) +apisToKeep.add(`onPluginInit`) + module.exports = function loader(source: string): string | null | undefined { const result = transformSync(source, { babelrc: false, @@ -12,7 +15,7 @@ module.exports = function loader(source: string): string | null | undefined { require.resolve(`../../utils/babel/babel-plugin-remove-api`), { apis: (Object.keys(nodeApis) as Array).filter( - api => !schemaCustomizationAPIs.has(api) + api => !apisToKeep.has(api) ), }, ],