[compiler:babel] Don't read config files when not running as part of

user's pipeline

When the user app has a babel.config file that is missing the compiler,
strange things happen as babel does some strange merging of options from
the user's config and in various callsites like in our eslint rule and
healthcheck script. To minimize odd behavior, we default to not reading
the user's babel.config

Fixes #29135

ghstack-source-id: d6fdc43c5c
Pull Request resolved: https://github.com/facebook/react/pull/29211
This commit is contained in:
Lauren Tan
2024-05-29 11:46:27 +09:00
parent c998bb1ed4
commit 9d530e94c4
4 changed files with 12 additions and 0 deletions
@@ -36,6 +36,8 @@ export function runBabelPluginReactCompiler(
"babel-plugin-fbt-runtime",
],
sourceType: "module",
configFile: false,
babelrc: false,
});
invariant(
result?.code != null,
@@ -143,6 +143,8 @@ const rule: Rule.RuleModule = {
[BabelPluginReactCompiler, options],
],
sourceType: "module",
configFile: false,
babelrc: false,
});
} catch (err) {
if (isReactCompilerError(err) && Array.isArray(err.details)) {
@@ -85,6 +85,8 @@ function runBabelPluginReactCompiler(
retainLines: true,
plugins: [[BabelPluginReactCompiler, options]],
sourceType: "module",
configFile: false,
babelrc: false,
});
if (result?.code == null) {
throw new Error(
+6
View File
@@ -333,6 +333,8 @@ export async function transformFixtureInput(
sourceType: "module",
ast: includeEvaluator,
cloneInputAst: includeEvaluator,
configFile: false,
babelrc: false,
});
invariant(
forgetResult?.code != null,
@@ -355,6 +357,8 @@ export async function transformFixtureInput(
const result = transformFromAstSync(forgetResult.ast, forgetOutput, {
presets,
filename: virtualFilepath,
configFile: false,
babelrc: false,
});
if (result?.code == null) {
return {
@@ -379,6 +383,8 @@ export async function transformFixtureInput(
const result = transformFromAstSync(inputAst, input, {
presets,
filename: virtualFilepath,
configFile: false,
babelrc: false,
});
if (result?.code == null) {