Skip to content

[preset-env] target.node=true should use package.engines.node #7277

@julien-f

Description

@julien-f

Is this a bug report or feature request?

Feature request

Input Code

var your => (code) => here;

Babel/Babylon Configuration (.babelrc, package.json, cli command)

{
  presets: ['env', { targets: { node: true } }]
}

package.json:

{
  "engines": {
    "node": ">=6"
  }
}

Expected Behavior

It should target the Node version specified in package.engines.node.

Current Behavior

It targets the current Node version.

Possible Solution

current should still use the current version, but true could use package.engines.node.

Context

I currently have to maintain in sync the targeted Node version both in package.json and in the Babel config.

Your Environment

software version(s)
Babel
Babylon
node
npm
Operating System

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions