Skip to content

Understanding usecases of manual .babelrc lookups and OptionManager use #5541

@loganfsmyth

Description

@loganfsmyth

In an ideal world, it makes no sense for third parties to reimplement .babelrc lookups in their own tools, and I think that fact that it isn't uncommon points to missing features from babel-core. I think it is important that we, as a team, understand why that approach is currently taken by tools using babel-core so that we can ensure the babel-core API provides the primitives that third parties need.

The cases I know of:

  • babel-loader resolves .babelrc for cache invalidation purposes
  • babel-jest uses the file for cache busting
  • babel-brunch is currently trying to use OptionManager to inject default behavior for
  • next.js previously resolved .babelrc and now uses the private config-chain API to decide when to inject a default preset vs rely on a user's local config

There may be other cases, but those at least make two points clear:

The second case I don't think we adequately expose currently. We have OptionManager but it's not a pretty API, and while it exposes the final config, it doesn't allow users to know if there was a config file, or if the config just came from the defaults. You can check if there a plugins/presets present, which may be enough in this case though, so I'd consider that an open question.

I'd be curious to hear from @arunoda since I've already had some back and forth about OptionManager in the Brunch PR, but the Next.js usecae is one I'm less clear on.

Metadata

Metadata

Assignees

Labels

outdatedA closed issue/PR that is archived due to age. Recommended to make a new issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions