-
-
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
Try to resolve browserslist config when targets are not specified #10897
Conversation
// Note, if browserslist resolves the config (ex. package.json), then usage | ||
// of `defaults` in queries will be different since we don't want to break | ||
// the behavior of "no targets is the same as preset-latest". | ||
if (!hasTargets) { |
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.
When hasTargets
is false
, objectToBrowserslist(targets)
always return []
.
const browsers = browserslist(browsersquery, { | ||
path: options.configPath, |
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.
Because browsersquery
is never undefined
here, browserslists
will never loadConfig
and therefore we don't need to pass path
option here.
|
||
if (shouldParseBrowsers || shouldSearchForConfig) { | ||
const browsers = browserslist(browsersquery, { |
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.
When browsersquery
is []
, it will precede browserslists.default
, therefore we don't need to overwrite browserslists.default
.
fb3666c
to
57b15e5
Compare
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.
I like the change from "down to es3" to browserslist's defaults, but we should put a big warning in the docs that defaults
is not a static compilation target.
@nicolo-ribaudo Note that although technically |
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/25186/ |
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 8a77cda:
|
eda2c4d
to
cf552f2
Compare
Superseded by #12989 |
This PR changes the targets parsing logic when targets are empty. It will now try to resolve any
browserslists
external configuration and fallback toforceAllTransforms: true
when neithertargets
is specified norbrowserslists
configuration is resolved.This PR also generally improves integrations with
browserslists
: thebrowserslists.default
is never changed during targets parsing. Surprisingly, by doing so we can remove a bunch of dead code.