PluginOptions Type — react Architecture
Architecture documentation for the PluginOptions type/interface in Options.ts from the react codebase.
Entity Profile
Dependency Diagram
graph TD 7ca03f1a_59b0_7536_3eff_d17a0b2786fe["PluginOptions"] 4828f3cc_e6ac_9239_d7f7_c05f7f60419c["Options.ts"] 7ca03f1a_59b0_7536_3eff_d17a0b2786fe -->|defined in| 4828f3cc_e6ac_9239_d7f7_c05f7f60419c style 7ca03f1a_59b0_7536_3eff_d17a0b2786fe fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
compiler/packages/babel-plugin-react-compiler/src/Entrypoint/Options.ts lines 54–180
export type PluginOptions = Partial<{
environment: Partial<EnvironmentConfig>;
logger: Logger | null;
/*
* Specifying a `gating` config, makes Forget compile and emit a separate
* version of the function gated by importing the `gating.importSpecifierName` from the
* specified `gating.source`.
*
* For example:
* gating: {
* source: 'ReactForgetFeatureFlag',
* importSpecifierName: 'isForgetEnabled_Pokes',
* }
*
* produces:
* import {isForgetEnabled_Pokes} from 'ReactForgetFeatureFlag';
*
* Foo_forget() {}
*
* Foo_uncompiled() {}
*
* var Foo = isForgetEnabled_Pokes() ? Foo_forget : Foo_uncompiled;
*/
gating: ExternalFunction | null;
/**
* If specified, this enables dynamic gating which matches `use memo if(...)`
* directives.
*
* Example usage:
* ```js
* // @dynamicGating:{"source":"myModule"}
* export function MyComponent() {
* 'use memo if(isEnabled)';
* return <div>...</div>;
* }
* ```
* This will emit:
* ```js
* import {isEnabled} from 'myModule';
* export const MyComponent = isEnabled()
* ? <optimized version>
* : <original version>;
* ```
*/
dynamicGating: DynamicGatingOptions | null;
panicThreshold: PanicThresholdOptions;
/**
* @deprecated
*
* When enabled, Forget will continue statically analyzing and linting code, but skip over codegen
* passes.
*
* NOTE: ignored if `outputMode` is specified
*
* Defaults to false
*/
noEmit: boolean;
/**
* If specified, overrides `noEmit` and controls the output mode of the compiler.
*
* Defaults to null
*/
outputMode: CompilerOutputMode | null;
/*
* Determines the strategy for determining which functions to compile. Note that regardless of
* which mode is enabled, a component can be opted out by adding the string literal
* `"use no forget"` at the top of the function body, eg.:
*
* ```
* function ComponentYouWantToSkipCompilation(props) {
* "use no forget";
* ...
* }
* ```
Source
Frequently Asked Questions
What is the PluginOptions type?
PluginOptions is a type/interface in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/Entrypoint/Options.ts.
Where is PluginOptions defined?
PluginOptions is defined in compiler/packages/babel-plugin-react-compiler/src/Entrypoint/Options.ts at line 54.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free