Lint and compiler

Compiler gating

A gating configuration identifies a module and exported function that chooses between compiled and uncompiled implementations. The choice is made during module evaluation, not on every render. Test both branches with the exact compiler version.

Formal Syntax & Structure

react syntaxreact
gating: { source, importSpecifier }

Working Example

Example Snippetreact
// Example Babel plugin configuration object; not executed.export const options={gating:{source:'./compiler-flag.js',importSpecifier:'isCompilerEnabled'}};export function isCompilerEnabled(){return false;} // Place this export in compiler-flag.js.
React Reference