Currently, I am utilizing Typescript version 2.4.2 along with Webpack for compilation purposes. Despite successful compilation, when running my code on IE11, an error 'Promise' is undefined arises.
Below is a glimpse of my tsconfig:
{
"compilerOptions": {
"outDir": "./wwwroot/js",
"sourceMap": true,
"allowJs": true,
"lib": [
"dom",
"es5",
"scripthost",
"es2015.iterable"
],
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"skipDefaultLibCheck": true,
"types": [ "es6-promise" ]
},
"include": [
"./Ts/**/*"
]
}
Additionally, here's my webpack configuration:
const path = require('path');
const webpack = require('webpack');
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
module.exports = {
entry: {
main: "./Ts/main.ts"
},
output: {
filename: "[name].js",
path: path.resolve(__dirname, "wwwroot/js")
},
devtool: "source-map",
resolve: {
extensions: [".ts", ".js"]
},
module: {
rules: [
{ test: /\.ts?$/, loader: "awesome-typescript-loader" },
{ enforce: "pre", test: /\.js$/, loader: "source-map-loader" }
]
},
plugins: [
new webpack.optimize.CommonsChunkPlugin({
name: 'vendor',
minChunks: Infinity
})
]
};
The need for a polyfill is evident, but I'm uncertain about the specific one required and its implementation. Recommendations so far have mentioned potential polyfills such as Promise and Whatwg-Fetch, yet attempts to incorporate them result in compile errors.