Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

React compiler healthcheck (and ESLint plugin) ignores all files if a babel.config.js file is present #29135

Closed
guillaumebrunerie opened this issue May 17, 2024 · 8 comments

Comments

@guillaumebrunerie
Copy link

Summary

Create the following two files in a new directory:

// index.jsx
const App = () => <div />;

// babel.config.js
export default {};

Then run npx react-compiler-healthcheck --src index.jsx. It reports Successfully compiled 0 out of 0 components.

Then remove the babel.config.js file (or comment out the line inside it) and run npx react-compiler-healthcheck --src index.jsx again. It now reports Successfully compiled 1 out of 1 components., as expected.

@guillaumebrunerie
Copy link
Author

In my real codebase it is not enough to comment out the contents of babel.config.js, I need to remove it entirely (or rename it).

With it I get Successfully compiled 0 out of 0 components. and without it I get Successfully compiled 370 out of 406 components.

@guillaumebrunerie guillaumebrunerie changed the title [React 19] React compiler healthcheck ignores all files if a babel.config.js file is present [React 19] React compiler healthcheck (and ESLint plugin) ignores all files if a babel.config.js file is present May 17, 2024
@guillaumebrunerie
Copy link
Author

This affects the ESLint plugin as well, with a babel.config.js it silently doesn’t report any errors, and removing it makes the ESLint plugin work.

@josephsavona josephsavona changed the title [React 19] React compiler healthcheck (and ESLint plugin) ignores all files if a babel.config.js file is present React compiler healthcheck (and ESLint plugin) ignores all files if a babel.config.js file is present May 17, 2024
@poteto
Copy link
Member

poteto commented May 17, 2024

Thanks for reporting. Could you share a repro app please?

@guillaumebrunerie
Copy link
Author

@poteto The OP contains a minimal repro, which I assumed would be enough to investigate the problem. Or do you need an actual working app?

@poteto
Copy link
Member

poteto commented May 17, 2024

an actual app would be ideal, there are many variables when it comes to builds so it'd help us figure this out more easily. fwiw I've run the healthcheck script on a few repos with babel configs

@guillaumebrunerie
Copy link
Author

I can reproduce it on an empty Vite app, if that helps? Although my original codebase (not open source) is a Webpack app.

$ npm create vite@latest bug-babel-config -- --template react
$ cd bug-babel-config
$ npx react-compiler-healthcheck
Successfully compiled 1 out of 1 components.
StrictMode usage found.
Found no usage of incompatible libraries
$ touch babel.config.js
$ npx react-compiler-healthcheck
Successfully compiled 0 out of 0 components.
StrictMode usage found.
Found no usage of incompatible libraries.

@guillaumebrunerie
Copy link
Author

Here is a real project of mine with the same issue: https://github.com/guillaumebrunerie/LD55.

@poteto
Copy link
Member

poteto commented May 20, 2024

I'll look into it, I think this is something to do with the eslint plugin picking up your config, and since it's empty, it doesn't run the compiler

poteto added a commit that referenced this issue May 22, 2024
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: 88a3958db2c6332167c00c9413645b1d14d848f4
Pull Request resolved: #29211
poteto added a commit that referenced this issue May 22, 2024
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: 5df2597983a0554d4c6698fe59a91ba8bd3f8e10
Pull Request resolved: #29211
poteto added a commit that referenced this issue May 22, 2024
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: 92b193508e7ce2951e487757b3bcad0a273f9e26
Pull Request resolved: #29211
poteto added a commit that referenced this issue May 22, 2024
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: f0fa887568c55a79b3dd9bd3f9bc0a4739c5aec0
Pull Request resolved: #29211
poteto added a commit that referenced this issue May 29, 2024
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: 1d9b7af02057718db9643c83f73ce827ab6ee40e
Pull Request resolved: #29211
poteto added a commit that referenced this issue May 29, 2024
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: 86daa0bc2390e02682675bc2fccb0bd83b64b7ac
Pull Request resolved: #29211
poteto added a commit that referenced this issue May 29, 2024
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
poteto added a commit that referenced this issue May 29, 2024
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
poteto added a commit that referenced this issue May 29, 2024
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
poteto added a commit that referenced this issue May 29, 2024
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: d6fdc43c5c9107645f36718203873aa3f6228475
Pull Request resolved: #29211
@poteto poteto closed this as completed in 9d530e9 May 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants