microsoft / BotFramework-WebChat

A highly-customizable web-based client for Azure Bot Services.
https://www.botframework.com/
MIT License
1.58k stars 1.53k forks source link

Better polyfilling for IE11 in NPM #2511

Open compulim opened 4 years ago

compulim commented 4 years ago

Feature request

Currently, the polyfilling story isn't great on NPM via create-react-app.

One approach is to follow what create-react-app does. To make CRA works in IE11, you will need to import 'react-app-polyfill/ie11'; and it will bring all polyfills required to make the CRA app works in IE11.

We could do something similar with:

import 'botframework-webchat/ie11';
import { ReactWebChat } from 'botframework-webchat';

Or

import 'botframework-webchat-polyfill/ie11';
import { ReactWebChat } from 'botframework-webchat';

Also, it seems Set does not need to be polyfilled.

Update from 2021-12-14

We should use @babel/plugin-transform-runtime and configure @babel/preset-env with useBuiltIns: "usage" to inline polyfills (a.k.a. ponyfills).

For NPM install, we should do some investigations, goals:

mchelen-gov commented 4 years ago

This would have a significant positive impact on the ability to use the bot framework through NPM package :+1:

Siri311 commented 4 years ago

Facing same issue with IE11. import 'botframework-webchat-polyfill/ie11'; (or) import 'botframework-webchat/ie11';

Not able to find after installing react-app-polyfill .

I am using SPFx with React (.ts and .tsx).

and installed npm i fast-text-encoding .

Thanks in Advance.

Siri311 commented 4 years ago

I'm using /webchat-es5.js/ CDN. Is there any solution for Bot not loading in IE but the same is getting loaded in Chrome and Edge. Getting Below console errors: Unable to get property 'createStore' of undefined or null reference Unable to get property 'renderWebChat' of undefined or null reference.

I have include the link and its working as expected in chrome and Edge. Even if i try to load using script in console also its loading but window.WebChat is undefined. but in chrome its loading and window.WebChat is available both in build and console.

Code

SPComponentLoader.loadScript("/jquery-3.3.1.min.js").then(function($:any) { SPComponentLoader.loadScript("https://cdn.botframework.com/botframework-webchat/latest/webchat-es5.js") setTimeout(function(){ SPComponentLoader.loadScript("/Widget-IE.js") },10000)
})