-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add browserslist 4 support. #8509
Conversation
Yeap, I highly recommend to include this PR to 7.0. People complained about the current behavior (merging |
Did you add |
In case we don't merge this before Friday, would it be possible to remove (or workaround) the breaking change? |
@nicolo-ribaudo it is possible, but will be bad for users. Merging behavior is what is expected (and how other tools do it). |
I added Let’s remove Can release it just after you will approve the query. |
Sounds awesome @ai |
"targets": { | ||
"node": "4.0.0" | ||
}, | ||
"targets": "node 4.0.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of modifying existing tests, should we just add new ones to make sure both syntaxes work (for now)?
Browserlist 4.1 was released with |
Just my 2 cents: it will be breaking change for babel-preset-env, not Babel if we'll land it after Babel 7 |
@chicoxyzzy babel preset env version is synchronised with all packages. So it will be a breaking change for all stuff. |
Actually it’s no so important to keep preset version in sync with Babel. More then that, this causes some issues. Also for example babel-loader and some other packages are not in sync with Babel version |
All packages in babel monorepo has the same version. babel-loader is part of it. |
c33997f
to
0ebb6eb
Compare
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/8893/ |
Should we remove |
@ai good point, will remove |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok looks good, I think the breaking change makes sense (targets shouldn't be related to browserslist)?
Do we need something else to merge it? Or just time for final decision |
Fixes Babel not reading from the package `browserslist` field due to a sneaky @babel/preset-env breaking change, see babel/babel#8509.
Fixes Babel not reading from the package `browserslist` field due to a sneaky @babel/preset-env breaking change, see babel/babel#8509.
After discussion with @ai and @existentialism and update browserslist to 4 we had an idea to possibly have
targets
as a query.For now, browserslist 4 supports
node
. So in most cases, we don't need to use a plain object to specify targets directly. It's mostly confusing to have 2 sources of truth and merge this targets. For many people, it works like magic under the hood and it's not everytime clear whychrome: 55, browsers: 'chrome 40'
will selectchrome 55
.With browserslist 4 we just can specify every target we need using the query:
targets: "node 8.1, last 2 chrome versions, maintained node versions"
.Most of the people are using targets as a plain object just to support
node
version. This PR containsnode current
andcurrent node
versions which are being replaced tonode ${currentNode}
query.So what was changed?
browserslist
to 4 and added node.js mappings.browserslistconfig
iftargets
field was specified. (Since browserslist support node) (breaking change).current node
andnode current
queries, which is replaced withnode ${CURRENT_VERSION}
.Would be good to merge it before babel 7, since it contains small breaking change (point 3).
cc @ai @existentialism