Skip to content

Move preset-env into @babel/core #3

Open
@hzoo

Description

@hzoo

Quick notes so not an RFC but just wanted to track. Relates to or depends on #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"
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions