Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign up[preset-env] target.node=true should use package.engines.node #7277
Comments
|
Hey @julien-f! We really appreciate you taking the time to report an issue. The collaborators If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack |
|
Wouldnt |
|
Concerning the browsers, |
|
I know its a standard field, but as it is an object with "node" key and it could easily support browsers too - but i guess it could have been more useful for other things (i.e. when consuming packages with specified |
|
Yes, it could support browsers as well, but this probably an issue that should be created in the |
|
For history/reference: babel/babel-preset-env#114 |
|
It should just read from That you have to set this up manually is my single biggest frustration with present-env. In .babelrc.js I require package.json and pull in It is shocking how many published packages don't follow best practice to define |
|
Agreed, but this should be overridable (maybe with |
|
Is this ticket still open? |
|
@xtuc I would like to take it if possible. |
|
Is the code responsible for this located here? |
|
You can reference a previous PR for this over at the old repo: babel/babel-preset-env#114. Keep in mind, there were some unresolved questions in that thread that we might want to nail down :) |
|
Excuse my naivety on this issue(and the Babel project in general), but why cant the node field in targets just have a simple true or false value, and require that people set their node version in package.engines.node in their package.json? In the package.json, you'd have to explicitly specify "current", ">=6" etc. |
|
Is this issue still open? Can I claim it? :) |
|
Is this still available to work on? |
|
I believe so. @existentialism do you confirm? |
|
What would be really nice is to be able to specify the |
Is this a bug report or feature request?
Feature request
Input Code
Babel/Babylon Configuration (.babelrc, package.json, cli command)
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
currentshould still use the current version, buttruecould usepackage.engines.node.Context
I currently have to maintain in sync the targeted Node version both in
package.jsonand in the Babel config.Your Environment