From 9d5ff320badcb81c914a010105fc033c2a595d4c Mon Sep 17 00:00:00 2001 From: Lauren Tan Date: Tue, 7 Nov 2023 18:58:21 -0500 Subject: [PATCH] [babel] Fix default value for `environment` option When an `environment` isn't explicitly provided by the user's config, we used to default this to `null` in `parsePluginOptions` which is called right at the start of the Babel plugin. These parsed options were then being passed to zod, which was expecting an object type, not null. Zod can reify a default config based on the schema, if an empty object is passed in. So by changing our default value to `{}` this should fix the compiler bailing out incorrectly on valid compiler options Test plan: tested this manually on the external repo by modifying node_modules --- .../babel-plugin-react-forget/src/Entrypoint/Options.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/packages/babel-plugin-react-forget/src/Entrypoint/Options.ts b/compiler/packages/babel-plugin-react-forget/src/Entrypoint/Options.ts index c5623c9d9e..04ece28d5c 100644 --- a/compiler/packages/babel-plugin-react-forget/src/Entrypoint/Options.ts +++ b/compiler/packages/babel-plugin-react-forget/src/Entrypoint/Options.ts @@ -146,7 +146,7 @@ export type Logger = { export const defaultOptions: PluginOptions = { compilationMode: "infer", panicThreshold: "CRITICAL_ERRORS", - environment: null, + environment: {}, logger: null, gating: null, instrumentForget: null,