Search code examples
javascriptandroides6-promisevuejs2polyfills

Importing the es6-promise polyfill into Vue.js


I am having problems loading a Vue component containing axios in older version of Android. After some research it pointed towards the browser not supporting Promises, hence the polyfill.

I have installed and imported the polyfill but still having problems.

import Promise from 'es6-promise';

Is the above correct? Or is there a further problem?


Solution

  • I have following line on top of my main.js:

    require('es6-promise').polyfill()
    

    other variant of it's use you can see in vue-hackernews-2.0 here:

    import 'es6-promise/auto'