Open mikemaccana opened 8 years ago
The docs mention:
"If you want to pass options to the transforms, you can use a 2-element array inside of the primary array. Here fff gets an options object with {"x":3} and ggg gets {"y":4}:"
{
"foo": {
"bar": [["fff",{"x":3}],["ggg",{"y":4}]]
}
}
Using an object would be a logical way to map "fff" and "ggg" to their respective options.
Using a key this way makes some semantics ambiguous:
{
"babelify": {
"presets": ["es2015"]
}
}
What if there is another key? This would be better:
{
"name": "babelify",
"options": {
"presets": "es2015"
}
}
but that is much more verbose than the array form.
Thanks for the quick reply Substack! LGTM.
From https://github.com/babel/babelify/issues/142, it seems the syntax where individual transforms are specified as arrays is correct.
The syntax for this part:
is odd: the array doesn't seem to be used as an ordered list of items.
"babelify"
is item 0,{"presets": ["es2015"]}
is item 1. What would item 2 be?If there wouldn't ever be an item 2, and this is simply a map between
babelify
and babelify's options, wouldn't an object be more logical?