Javascript Promises Fix for Internet Explorer

This post maybe a bit technical for non-programmers but I am sure it may come in handy to others.

I had recently been talked into trying out ReactJS by Ozoesono and I was totally love struck.

I decided to use Axios the Promises based client for http requests on a recent project. You can imagine the shocker on me when upon deployment I discovered that Internet Explorer 11 does not support the ES6 Promises and hence all Axios calls were broken on that browser.

A quick digging presented a solution that could work out of the box in a gulp building environment but for Webpack it could leave a developer cracking his head.

well it turns out I just needed to install the polyfills package and modify my webpack environment.

Type the command into your terminal and hit Enter

npm install babel-polyfill --save-dev

and modify webpack.config.js

`module.exports = {

context: __dirname,

entry: ['babel-polyfill','./static/js/index'],

/* entry point of our app. assets/js/index.js should require other js modules and dependencies it needs */

..... }

This solved my problem and all broken Promises based request were fixed on IE for Axios and I believe similar approach should for similar libraries like fetch.

Thanks for reading thus far :)

comments powered by Disqus

Abdulhakim Haliru

Abdulhakim is Chief Technology Officer at Le Proghrammeen, He spends everyday helping businesses in Nigeria with technological products that helps them reach their goals.