使用babel

时间:2018-08-20 11:46:42

标签: javascript internet-explorer-11 babeljs

gruntbabel任务一起使用会在IE11中引发以下错误:'symbol'未定义。错误从何而来?我尝试了不同的babel预设,但是没有一个起作用。它适用于除IE之外的所有浏览器。是Babel的错误还是我的错误? (迭代器及其变量由babel自动创建)。预设es2015-iees2015都不起作用。

var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;

try {
    for (var _iterator = chart_df[site_id][Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
        chartData = _step.value;

        sortedCharts[chartData.ranking] = chartData;
    }

    // Removes empty slots from array
} catch (err) {
    _didIteratorError = true;
    _iteratorError = err;
} finally {
    try {
        if (!_iteratorNormalCompletion && _iterator.return) {
            _iterator.return();
        }
    } finally {
        if (_didIteratorError) {
            throw _iteratorError; <-- UNDEFINED IN IE11
        }
    }
}

0 个答案:

没有答案