Closed dariocravero closed 8 years ago
Thanks! Merged: dc3ff6640aef62dd1612aa94b2dd3bc9985a5389
Good stuff :)
Could you publish a patch? Thanks! :)
+ babel-plugin-async-to-promises@1.0.5
Thanks! On Sun 24 Apr 2016 at 15:13, Marten de Vries notifications@github.com wrote:
- babel-plugin-async-to-promises@1.0.5
— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/marten-de-vries/kneden/pull/49#issuecomment-213964462
Here's a fix for an edge case with kneden's function hoisting from functions defined as object values.
If you're using the
es2015
preset, a code like:Pre kneden would be converted to:
This is because of
babel-helper-function-name
. Essentially the functions get a name. The problem is that if different objects have the same keys and those keys happen to have functions as values, their name would be the same. That doesn't seem to matter at runtime though... but! If you pass it through kneden, you get this:And that's the end of the game because the last definition of
a
wins and you loose one function :(. Here's a repo with sample code showing the issue.I first thought this was a babel issue, see https://github.com/babel/babel/pull/3474. The way I see it, babel's output, despite seeming technically sound, feels a bit confusing for its users.
Because I don't know if the fix will make it into babel, I'm filing this PR to prevent kneden from hoisting those types of functions. :)