-
Notifications
You must be signed in to change notification settings - Fork 213
Allow using browserlistsrc for targets #1149
Conversation
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.
LGTM, @edmorley?
packages/web/index.js
Outdated
@@ -90,7 +94,7 @@ module.exports = (neutrino, opts = {}) => { | |||
'last 2 iOS versions' | |||
]; | |||
} | |||
|
|||
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.
Can you revert the change to this line?
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.
Whups
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.
Whoopsiedaisy
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.
Thank you for the PR :-)
packages/web/index.js
Outdated
if (!options.targets.node && !options.targets.browsers) { | ||
if (options.targets === false) { | ||
options.targets = {}; | ||
} else if (options.targets.browsers === false) { |
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.
For options.targets.browsers
to be false
, they would have had to set it themselves as false
, since targets
defaults to {}
. For "I want babel to just use its own logic" I think getting people to always use targets: false
might make more sense?
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.
Yeah - I did it this way because it seemed like options.targets
had other props besides browsers
that maybe you'd want to set, but still use the browerslistrc. Not totally sure of that's valid though, will have to check when I'm back on a machine: https://babeljs.io/docs/en/babel-preset-env#options
@edmorley I think you're right – we only need to support Updated PR. I also moved the defaults for the browsers up to the top with the other defaults. |
Actually, if we set the defaults up-top like this, we don't even need to account for Just passes things directly to |
The preset default options are merged with the ones the user passes using deepmerge, so I think the new implementation will prevent people from overriding. Some tests would confirm and likely be useful edither way :-) |
@edmorley right you were :) Reverted that and added some tests. |
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.
This looks great - thank you!
Resolves #1141
Allows users to pass
false
tooptions.targets
oroptions.targets.browsers
to have babel-env use a.browserlistsrc
file.