I am converting React code to typescript, target in tsconfig is es5.
on running in IE 11 i get an error \"Promise is undefined\"
I know i need to polyfill,bu
Install these packages:
npm install es6-promise
npm install whatwg-fetch
Then update weback configuration:
module.exports = {
context: path.resolve(__dirname, 'src'),
entry: ['whatwg-fetch', './index.js'], <========== add whatwg-fetch !!!!
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'bundle.js',
},
resolve: {extensions: ['.js', '.jsx']},
plugins: [
new CleanWebpackPlugin(['dist']),
new HtmlWebpackPlugin({ template: 'index.html' }),
new webpack.ProvidePlugin({
React: 'react',
Promise: 'es6-promise' <============ add Promises for IE !!!
}),
],
module: ...