question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support `"root": true` for old config sources in v7

See original GitHub issue

Feature Request

Is your feature request related to a problem? Please describe.

Babel’s previous config file loading behavior searches for config files relative to the file location. This has caused problems when users want to apply project-wide configurations to multiple packages or dependencies.

v7 now has babel.config.js which is applied project-wide, but users can no longer use config inside package.json to get the same behavior.

Describe the solution you’d like

The proposal is to add a root option to old config sources (.babelrc and package.json -> "babel"). With root: true and located in current working project’s root, the old config sources would act as babel.config.js and be applied project-wide.

Old config sources in nested packages or node_modules are ignored by default after #7358, and should still be even with root: true.

Describe alternatives you’ve considered An alternative is adding an option to babel-core that enables babel.config.js behavior for all config sources, but that can make the behavior of old config sources ambiguous for analysis tools.

Teachability, Documentation, Adoption, Migration Strategy This should probably be introduced/documented alongside babel.config.js in the v7 release. For users it’s either renaming to babel.config.js or add root: true to an old config source.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:2
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
loganfsmythcommented, May 18, 2018

How would people feel about it being global: true or some other alternative? To state that the config applies to all files that Babel is told to process, similar to Browserify transform’s global option to apply a transform to all files.

We’ve already got a string-typed root option that sets the root directory that Babel uses for resolution, so I don’t want to override that, and I think a boolean root would also be easy to confuse with ESLint’s root option, which has a totally different behavior from what we’re looking to have this flag to.

0reactions
loganfsmythcommented, Aug 20, 2018

Alright, good to know. I think at this point my preference might be to wait and see if others come to us with the same concern.

Adding another flag isn’t the end of the world, but it does mean that the file-relative and working-directory config loading have to be aware of eachother, where right now they are entirely independent. We’d also need to make our option validation system aware that .babelrc and package.json configs may have different sets of options.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Options - Babel.js
In older Babel 7 versions, only babel.config.js is supported. "root" - Passes the "root" value through as unchanged. " ...
Read more >
User Interface Configuration - LYRASIS Wiki
These instructions will allow you to migrate your old (7.0 or 7.1) "environment.*.ts" configuration file to the new "config.*.yml" format. First ...
Read more >
Configuration - Sphinx documentation
Sphinx considers the files with this suffix as sources. The value can be a dictionary ... By default, Sphinx only supports 'restructuredtext' file...
Read more >
rubyconfig/config - GitHub
Config helps you easily manage environment specific settings in an easy and usable manner. Features. simple YAML config files; config files support ERB;...
Read more >
Upgrading your build from Gradle 7.x to the latest
This chapter provides the information you need to migrate your Gradle 7.x builds to the latest Gradle release. For migrating from Gradle 4.x,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found