bublejs / buble

https://buble.surge.sh
MIT License
869 stars 67 forks source link

fix: make letConst transpilation add explicit keys when appropriate #229

Closed luiscubal closed 4 years ago

luiscubal commented 4 years ago

When letConst transpilation is on, buble renames some variables, such as x->x$1. However, when shorthand properties are used, this causes the property key to change. The appropriate fix is to make those properties no longer be shorthand, so something like { x : x$1 } is used. This applies both to object literals and object destructuring patterns.

The destructuring and concise property transpilation options hide this bug, so this commit only improves the situation for use-cases where letConst transpilation is used without those options.