承诺内部承诺陷入“未决”

时间:2017-02-02 14:37:15

标签: javascript webpack ecmascript-6 es6-promise webpack-2

我正在尝试导入一个导出Promise的模块:

System.import('./details.js').then(details => {
            console.log(details.default); // returns a pending Promise

            details.default.then(m => {
                console.log(m); // never executes, I expect to see 'whatever' here
            })
        });

我尝试导入的模块:

export default Promise
    .all([
        System.import('./dateHelper'),
        System.import('charts'),
    ])
    .then(mods => Promise.all(mods.map(mod => mod.default)))
    .then(([dateHelper, charts]) => {

     /* ...module content... */

     return 'whatever';
});

我是否在导出模块时犯了错误,导致永无止境的Promise?

0 个答案:

没有答案