mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
[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:
@@ -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(
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user