解构不可迭代实例的无效尝试 - Bot 4.0 WebChat.js

Invalid attempt to destructure non-iterable instance - Bot 4.0 WebChat.js

[object Error]: {message: "Invalid attempt to destructure non-iterable instance", stack: "TypeError: Invalid attempt to destructure non-iterable instance at e.exports (https://cdn.botframework.com/botframework-webchat/latest/webchat.js:1:566613) at e.exports at t.unstable_runWithPriority (https://cdn.botframework.com/botframework-webchat/latest/webchat.js:1:351563) at Rs (https://cdn.botframework.com/botframework-webchat/latest/webchat.js:1:339772) at Ps (https://cdn.botframework.com/botframework-webchat/latest/webchat.js:1:339567)"}

 (async function () {
        const res = await fetch('https://tokenservice/api/DLToken', { method: 'POST' });        
        const {token}  = await res.json();
        console.log({token});
        window.WebChat.renderWebChat(
            {
                bot: bot,
                directLine: window.WebChat.createDirectLine({token}),
                user: user,
                speechOptions: speechOptions,
                resize: 'detect',
                styleOptions: styleOptions
            },
            document.getElementById('BotChatGoesHere')
        );

我在 Edge 和 IE 中遇到这个错误,在 Chrome 中它工作正常。请提出解决方案,将有义务。

IE 11 不支持 async/await 关键字。我们需要在 IE 中使用 es5 bundle。请尝试使用 https://cdn.botframework.com/botframework-webchat/latest/webchat-es5.js 代替。

参考:

Latest WebChat : IE11 Compatibility

Sample - Getting Started with Web Chat CDN with ES5 Polyfills