Move preset-env into `@babel/core`

Open
#3 2 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Stale
Tech stack
javascript
Domain
compilers

Research direction

Start by reading the related Babel RFC pull request #2 and the proposal's existing, moved-targets, and no-preset configuration examples. Determine the compatibility and versioning implications of moving preset-env into @babel/core, including opt-out behavior; done means the design is resolved and documented well enough for implementation.

Written by the indexing model from the issue text.

Description

Quick notes so not an RFC but just wanted to track. Relates to or depends on https://github.com/babel/rfcs/pull/2 which moves the targets config to @babel/core. Just taking that idea further.

Not a new idea by any means, just haven't seriously considered it since it changes how people think about it so much (I think for the better).

Just means you don't need to install a package, configure the use of the preset, or track the versions (a big deal, even when comparing to other tools in this space -> whether it's Babel 5, esbuild,sucrase,buble,swc,typescript,etc). It is confusing that you have to install the package as well as configure it in the config.

I Assume that most people who use Babel intend to use this preset currently and if not, we want them too? Why not just include it then, with some way of opt-out for tooling, special builds, or people that want to do something else.

Can we do this in a minor version? Maybe doesn't apply unless you use the new top-level targets option.
I think this was kinda my intention from the start but it took a while to get this in place and we forgot to just do this a long time ago? Similar to preset-modules, preset-env was an experiment, then a separate repo, and replaced preset-latest/es2015/etc.
Means that plugins (other than tc39 proposals) would be built-in to babel once again (babel 5), although we could keep them separate for organizational purposes. Should help somewhat with the versioning/install/dep we've had for a long time.

// existing config
{
  "presets": [
    ["@babel/preset-env", {
      "targets": ">1%, not ie 11"
    }]
  ]
}
// move targets into core https://github.com/babel/rfcs/pull/2
{
  "targets": ">1%, not ie 11",
  "presets": ["@babel/preset-env"]
}
// this proposal (targets can have some default in v8) but in v7 if this is done in a minor it can be undefined/false
{
  "targets": ">1%, not ie 11"
}
Dominant language
No language data
Stars
25
Forks
10
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Similar issues

More Compilers issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.