Hi I have bot framework implementation using Nodejs and reactjs in azure web app. The code works perfectly fine in Edge, Chrome but IN IE, i get blank page with the error attached. Below is the code. In Fact even when i try one of the example microsoft has on github it fails to load in IE. Here is the sample.
I did some reasearch and found out that reactjs does have some rendering issue with IE and that we should use polyfill package in our code, which i did still no luck.
import 'react-app-polyfill/ie11';
declare var require: any
var React = require('react');
var ReactDOM = require('react-dom');
import ReactWebChat, { createDirectLine } from 'botframework-webchat';
import { createStore } from 'botframework-webchat';
import { createStyleSet } from 'botframework-webchat';
import updateIn from 'simple-update-in';
import "babel-polyfill";
import "isomorphic-fetch";
//import 'react-app-polyfill/ie11';
export class BotFrameworkApp extends React.Component {
constructor() {
super();
this.state = {
directLine: null,
styleSet: null,
};
}
const response = await fetch('https://directline.botframework.com/v3/directline/tokens/generate', {
method: 'POST',
headers: {
'Authorization': 'Bearer token',
'Accept': 'application/json',
'Content-Type': 'application/json',
'Access-Control-Request-Headers': 'x-requested-with'
},
body: JSON.stringify({
accessLevel: 'View',
allowSaveAs: 'false',
})
});
const { token } = await response.json();
//already set and now send
this.setState(() => ({
directLine: createDirectLine({ token }),
userName: loginID,
webchatStore: createStore({}, middleware),
styleSet: createStyleSet({
hideUploadButton: true,
bubbleBackground: 'rgba(0, 0, 255, .1)',
bubbleFromUserBackground: 'rgba(0, 255, 0, .1)',
})
}));
}
render() {
const {
state: { data }
} = this
return (
this.state.directLine && this.state.webchatStore ?
<ReactWebChat
className="chat"
directLine={this.state.directLine}
styleSet={this.state.styleSet}
/>
:
<div>Connecting to bot…</div>
);
}
}
ReactDOM.render(<BotFrameworkApp />, document.getElementById('root'));
This is the error,
My tsconfig
{
"compilerOptions": {
"noImplicitAny": false,
"module": "commonjs",
"noEmitOnError": true,
"removeComments": false,
"sourceMap": true,
"target": "es6",
"jsx": "react"
},
"exclude": [
"node_modules"
],
"files": [
"app.tsx"
]
}
My Webpack-config.js
module.exports = {
devtool: 'source-map',
entry: './app.tsx',
mode: "development",
output: {
filename: "./app-bundle.js"
},
resolve: {
extensions: ['.Webpack.js', '.web.js', '.ts', '.js', '.jsx', '.tsx']
},
module: {
rules: [
{
test: /\.tsx$/,
exclude: /(node_modules|bower_components)/,
use: {
loader: 'ts-loader'
}
}
]
}
}