From 8da83ff9b0bde5dd88c78debf2d7e000bfedf4e1 Mon Sep 17 00:00:00 2001 From: Michal Piechowiak Date: Fri, 21 Jan 2022 15:25:16 +0100 Subject: [PATCH] fix(gatsby): don't remove onPluginInit in graphql-engine (#34558) (cherry picked from commit 135e0803bd3d45f8062c3797f7b12fb77f373ca8) --- .../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) ), }, ],