Skip to content

.babelrc should be looked up in parent directories #188

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

Closed
ehmicky opened this issue Sep 5, 2019 · 2 comments
Closed

.babelrc should be looked up in parent directories #188

ehmicky opened this issue Sep 5, 2019 · 2 comments
Labels
type: bug code to address defects in shipped code

Comments

@ehmicky
Copy link
Contributor

ehmicky commented Sep 5, 2019

At the moment, the .babelrc is only looked up in the current directory. However I think babel/loader forwards the babelrc option to babel, which then looks up any babel configuration file. So the current logic might consider the user has no Babel configuration, even though they do.

This is especially likely inside monorepos.

Another issue is that Babel configurations can also be called babel.config.js, .babelrc.js or be a babel property inside package.json.

Checking the parent directories would be easy to implement (e.g. using find-up).

A more proper way might be to use the @babel/core package though, and use their methods to check if there's a Babel configuration.

@ehmicky ehmicky changed the title Feature proposal: lookup .babelrc in parent directories .babelrc should be looked up in parent directories Sep 5, 2019
@stale
Copy link

stale bot commented Nov 4, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Nov 4, 2019
@stale stale bot closed this as completed Nov 11, 2019
Robin-Hoodie added a commit to Robin-Hoodie/netlify-lambda that referenced this issue Jan 13, 2021
I've added find-up as a dependency for finding the babel config file.
The babel config files to look for have been taken from @babel/core's sourcecode
Finally, as babel-loader itself will by default not look outside of the cwd
for the config file, we don't want to have false positives for any babel config
files that exist outside of the cwd

Closes netlify#200, netlify#188
@erezrokah erezrokah reopened this Jan 14, 2021
@erezrokah erezrokah added type: bug code to address defects in shipped code and removed stale labels Jan 14, 2021
@erezrokah
Copy link
Contributor

Fixed via #364

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug code to address defects in shipped code
Projects
None yet
Development

No branches or pull requests

2 participants