Skip to content

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

Closed
wants to merge 4 commits into from

Conversation

Robin-Hoodie
Copy link
Contributor

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 #200, #188

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
@Robin-Hoodie
Copy link
Contributor Author

I'm not sure what the "Required PR Labels" is complaining about. Is this something I'm supposed to fix?

@erezrokah erezrokah added the type: bug code to address defects in shipped code label Jan 14, 2021
@erezrokah
Copy link
Contributor

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.

@erezrokah erezrokah self-requested a review January 14, 2021 18:06
Copy link
Contributor

@erezrokah erezrokah left a 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());
Copy link
Contributor

@erezrokah erezrokah Jan 14, 2021

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.

Copy link
Contributor Author

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?

@erezrokah
Copy link
Contributor

erezrokah commented Jan 14, 2021

Also, do you mind creating the PR from a dedicated branch. It makes it easier to review and push changes for the maintainers?

@Robin-Hoodie
Copy link
Contributor Author

@erezrokah Created #364
I'm quite new to contributing to open source, so do let me know if there's anything else you expected different

@erezrokah
Copy link
Contributor

Thanks @Robin-Hoodie that's great. Closing this in favor of #364.

Also, do you mind creating the PR from a dedicated branch. It makes it easier to review and push changes for the maintainers?

This should actually be a part of our contributing guide - I'll update it.

@erezrokah erezrokah closed this Jan 15, 2021
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

Successfully merging this pull request may close these issues.

.babelrc.js ignored
2 participants