The following works perfectly:
export default function x () {
return 'hello world'
}
export function y () {
return x()
}
console.log(y())
However this does not work:
export default async function x () {
return 'hello world'
}
export function y () {
return x()
.then(console.log)
}
y()
When the default
function is async
for some reason x is not defined
.
The following works perfectly:
export default function x () {
return 'hello world'
}
export function y () {
return x()
}
console.log(y())
However this does not work:
export default async function x () {
return 'hello world'
}
export function y () {
return x()
.then(console.log)
}
y()
When the default
function is async
for some reason x is not defined
.
- Do you need a polyfill of some kind for this? I remember some kind of babel polyfill solving something like this. Also what happens if you remove "default". – Tim Consolazio Commented Dec 17, 2016 at 22:12
- 1 @TimConsolazio If I remove it, it works perfectly fine. – ThomasReggi Commented Dec 17, 2016 at 22:15
-
I'm using the babel
latest
plugin. – ThomasReggi Commented Dec 17, 2016 at 22:15
1 Answer
Reset to default 4Looks like this is a known issue inside babel project: https://github./babel/babel/issues/3786