-
Notifications
You must be signed in to change notification settings - Fork 213
web/node: Easier targeting via options.targets #438
web/node: Easier targeting via options.targets #438
Conversation
The reason I have shied away from doing something like this has to do with parity of the Node.js preset. The phrase Using ['@neutrinojs/web', {
targets: {
browsers: [/* ... */]
}
}]
['@neutrinojs/node', {
targets: {
node: /* ... */
}
}] Using ['@neutrinojs/web', {
browsers: [/* ... */]
}]
['@neutrinojs/node', {
node: /* ... */
}] |
Yeah I'd be fine with just exposing |
Let's get some more opinions. @mozilla-neutrino/core-contributors any thoughts? |
I like the idea of maintaining parity with I updated my PR to pass |
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 good to me. @mozilla-neutrino/core-contributors anyone else have any concerns?
@timkelty could you also add this option to the docs? |
Will do. |
Docs updated. |
docs/packages/node/README.md
Outdated
targets: { | ||
node: '6.10' | ||
} | ||
|
||
// Add additional Babel plugins, presets, or env options | ||
babel: { | ||
// Override options for babel-preset-env, showing defaults: | ||
presetEnv: { |
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.
Hmm, there is no more presetEnv
here, must be a typo. Can you update this to:
babel: {
presets: [
['babel-preset-env', {
?
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.
Ah yep - I wondered about that.
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.
Looks good! As soon as we get that existing typo fixed, we can merge this.
Good idea! I was only thinking the other day that our configs were pretty verbose just to specify a reduced set of targets. So long as the |
Docs are fixed! |
It is currently rather verbose to override the
targets.browsers
option forbabel-preset-env
, and it requires you to overwrite the whole options object rather than just specifying browsers: https://neutrino.js.org/presets/neutrino-preset-web/#preset-optionsThis PR adds
options.browsers
to be able to specify directly.Furthermore, when babel-preset-env@7.0 is released (currently at beta.32), this will make it easier for users that want to use a browserslist config file, as the new version of babel-preset-env will look for those automatically. In that case, we can support passing
false
orundefined
to have babel-preset-env/browserslist do its thing.