【发布时间】:2016-06-29 13:54:58
【问题描述】:
我想自定义我的 babelrc 以添加一些额外的插件。 Based on the 1.3.4 release notes,看起来完全可以。所以我做了这样的:
{
"presets": ["babel-preset-meteor"],
"plugins": ["add-module-exports", "transform-class-properties"]
}
但是,现在每当我尝试使用 async/await 时,它都会完全中断,说流星代码必须在光纤中运行。
Exception while invoking method 'add address' Error: Meteor code must always run within a Fiber.
这来自一个看起来像这样的方法:
export async function addAddress() {
await [whatever];
}
Meteor.methods({
'add address': addAddress
});
如果我完全删除 .babelrc,它似乎可以工作。
【问题讨论】:
-
你可能需要将你的 async 包装在
Meteor.bindEnvironment()中,但我不完全确定。 -
但问题是,没有使用 .babelrc,它完全可以正常工作
标签: javascript asynchronous meteor ecmascript-6 babeljs