Skip to content

Commit

Permalink
[compiler:babel] Don't read config files when not running as part of
Browse files Browse the repository at this point in the history
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: 5c3cb02f3254e0ccaf075ab5a3cd8b32714a1573
Pull Request resolved: #29211
  • Loading branch information
poteto committed May 29, 2024
1 parent 8399f44 commit 2f0de92
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ export function runBabelPluginReactCompiler(
"babel-plugin-fbt-runtime",
],
sourceType: "module",
configFile: false,
babelrc: false,
});
invariant(
result?.code != null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ const rule: Rule.RuleModule = {
],
sourceType: "module",
configFile: false,
babelrc: false,
});
} catch (err) {
if (isReactCompilerError(err) && Array.isArray(err.details)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ function runBabelPluginReactCompiler(
plugins: [[BabelPluginReactCompiler, options]],
sourceType: "module",
configFile: false,
babelrc: false,
});
if (result?.code == null) {
throw new Error(
Expand Down
3 changes: 3 additions & 0 deletions compiler/packages/snap/src/compiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,7 @@ export async function transformFixtureInput(
ast: includeEvaluator,
cloneInputAst: includeEvaluator,
configFile: false,
babelrc: false,
});
invariant(
forgetResult?.code != null,
Expand All @@ -357,6 +358,7 @@ export async function transformFixtureInput(
presets,
filename: virtualFilepath,
configFile: false,
babelrc: false,
});
if (result?.code == null) {
return {
Expand All @@ -382,6 +384,7 @@ export async function transformFixtureInput(
presets,
filename: virtualFilepath,
configFile: false,
babelrc: false,
});

if (result?.code == null) {
Expand Down

0 comments on commit 2f0de92

Please sign in to comment.