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

Expose findbabelrc method #7259

Closed
wants to merge 1 commit into from
Closed

Expose findbabelrc method #7259

wants to merge 1 commit into from

Conversation

rajasekarm
Copy link
Member

Q                       A
Fixed Issues?
Patch: Bug Fix?
Major: Breaking Change?
Minor: New Feature?
Tests Added + Pass?
Documentation PR
Any Dependency Changes?
License MIT

@Andarist
Copy link
Member

Im all in for this change - it would be good though to document why this is needed. Most times finding this should be left to babel

@babel-bot
Copy link
Collaborator

babel-bot commented Jan 23, 2018

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/6837/

@nicolo-ribaudo
Copy link
Member

nicolo-ribaudo commented Jan 23, 2018

I think that we should expose a method which loads the config (merges the applicable .babelrcs, handles overrides...)

@@ -30,7 +30,7 @@ export function findBabelrc(
filepath: string,
envName: string,
): ConfigFile | null {
const dirname = path.dirname(filepath);
const dirname = filepath ? path.dirname(filepath) : process.cwd();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could also consider changing this function to accept a dirname as the argument. Then you can call

findBabelrc(process.cwd(), "");

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One concern I have about exposing this is that we probably want to change the signature of this function more in the future, and it will be easy to miss that we're breaking a public API. I'm wondering if it would be better to make a new function right in src/index.js that calls through to this. For instance we may add flags to tell a the .babelrc.js file whether Babel allows a promise to be returned, and we'll probably add another parameter for passing a root folder to stop searching at.

@Andarist
Copy link
Member

I think that we should expose a method which loads the config (merges the applicable .babelrcs, handles overrides...)

Yeah, this seems more useful :) still I'd like to discuss exact use cases (we could even list them in the docs and advise people not to use it for regular use cases)

@loganfsmyth
Copy link
Member

I'm going to close this for now since I don't think it's what we want, but I do think exposing something will be good, and we can continue this discussion in Slack.

@lock lock bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Oct 4, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Oct 4, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated A closed issue/PR that is archived due to age. Recommended to make a new issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants