-
Notifications
You must be signed in to change notification settings - Fork 116
fix: support babel config file names other than .babelrc #359
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
Conversation
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
I'm not sure what the "Required PR Labels" is complaining about. Is this something I'm supposed to fix? |
That's on us - we use PR labels internally. Thanks for the PR, I'll review it today. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @Robin-Hoodie, nice work and kudos on updating the docs.
I added a comment about monorepo support.
Also would it make sense to add tests for this?
Seems like there can be a few use cases we can try (single repo, monorepo, different config files).
); | ||
if (babelConfigFile) { | ||
// Ensure babel config files outside of working dir are not accounted for | ||
return babelConfigFile.includes(process.cwd()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this work for monorepos when the babel config is in the root directory?
We could find-up
a .git
and use that value (or cwd
if it doesn't exist).
We might also want to use a matcher and findUp.stop
to stop the search if we detect we're outside the root.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it would make sense to search outside the cwd. Babel will by default also not look outside the cwd for a config file.
Do you imagine a scenario in a monorepo where the user runs netlify-lambda
from a subdir while they want to use the babel config in the root dir?
Also, do you mind creating the PR from a dedicated branch. It makes it easier to review and push changes for the maintainers? |
@erezrokah Created #364 |
Thanks @Robin-Hoodie that's great. Closing this in favor of #364.
This should actually be a part of our contributing guide - I'll update it. |
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 sourcecodeFinally, 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 #200, #188