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

Ejecting should keep .babelrc treated as root #1066

Closed
gaearon opened this issue Nov 20, 2016 · 10 comments
Closed

Ejecting should keep .babelrc treated as root #1066

gaearon opened this issue Nov 20, 2016 · 10 comments

Comments

@gaearon
Copy link
Contributor

gaearon commented Nov 20, 2016

Not sure there's an easy way to fix it but I think that after we eject and generate babel config in package.json it may start looking for more configs in parent folders (which it doesn't do now thanks to this).

If my understanding is correct this might "break" projects on ejecting if there are .babelrc in parent folders.

Help wanted: confirm whether it's an issue, and if it is, propose a fix.

@anilreddykatta
Copy link
Contributor

@gaearon If the project already has a .babelrc with different presets which one do you think should take preference?

@gaearon
Copy link
Contributor Author

gaearon commented Apr 19, 2017

It is not supported to have .babelrc before ejecting.
I think ejecting should fail if you already have one.

@anilreddykatta
Copy link
Contributor

@gaearon Currently, we fail ejecting if we have .babelrc at project root?

@BrodaNoel
Copy link
Contributor

@gaearon any clue about it? I can work on it if you give me the first clue about where I should start.

@gaearon
Copy link
Contributor Author

gaearon commented May 22, 2017

Any clue about what specifically?

@gustavogodoi
Copy link

PR #3803 opened to try to add this validation.

@viankakrisna
Copy link
Contributor

viankakrisna commented Jan 24, 2018

eslint has root: true to tell it to stop searching for config in parent folder https://eslint.org/docs/user-guide/configuring#using-configuration-files i think we can port the feature to babel?

edit: related discussion: babel/babel#6766

@gustavogodoi
Copy link

Maybe we could use loader-utils to check the babel config. loaderUtils.getOptions(this).babelrc should get the config.

e.g. from babel-loader:
https://github.com/babel/babel-loader/blob/master/src/index.js#L113

@loganfsmyth
Copy link

Babel will stop searching up the directory hierarchy when it encounters:

  • A directory containing a .babelrc
  • A directory containing a package.json that contains a babel field.

I believe that means this should be fine as long as you create the .babelrc. As mentioned above, with babel/babel#6766 we may also add a concept of a root to Babel which would not search above the given root, among other things.

@stale
Copy link

stale bot commented Nov 2, 2018

This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 7 days if no further activity occurs.

@stale stale bot added the stale label Nov 2, 2018
@Timer Timer closed this as completed Nov 2, 2018
@lock lock bot locked and limited conversation to collaborators Jan 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants