Transpiling Spread Operator to `Object.assign` is still ES6
Transpiling code with the Spread Operator like:
let obj = {
one: 'value',
...({
spreading: 'more',
important: 'values'
})
}
transpiles into:
var obj = Object.assign({}, {one: 'value'},
({
spreading: 'more',
important: 'values'
}))
using Object.assign
. And using the objectAssign
option or adding a polyfill make this work in old browsers.
However, without manually taking care of this, technically buble produces ES6 output. This contradicts my expectations:
- Buble produces ES5 output
- Buble doesn't bring polyfills
- Buble throws an error if the code can't be transpiled into ES5
Are my expectations wrong?