2016-03-05 136 views
1

使用異步時獲取意外的標記/與巴別等待6意外標記與巴別等待

boot.js

require("babel-core/register")({ 
    ignore: "./node_modules" 
}); 
require("babel-polyfill"); 

asyncAwaitSample.js

async function() { 
    await someAsyncAction(); 
    }() 

.babelrc

{ 
    "presets": ["es2015", "stage-0", "react"] 
} 

編譯器在字符串async function() {上拍攝錯誤,它表示「意外的令牌」{'「

+0

放'()'周圍的功能 – Ramanlfc

+0

我試過,但它在等待someAsyncActi時發生錯誤on();'string then – maxpolski

回答