以下完美运行:
export default function x () {
return 'hello world'
}
export function y () {
return x()
}
console.log(y())
但是这不起作用:
export default async function x () {
return 'hello world'
}
export function y () {
return x()
.then(console.log)
}
y()
当 default
函数由于某种原因 x 未定义
而为 async
时。
最佳答案
看起来这是 babel 项目中的一个已知问题:https://github.com/babel/babel/issues/3786
关于javascript - 导出默认异步函数未在当前文件中定义,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41203540/