Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ie11 Promise supported? #114

Closed
hayesmaker opened this issue Apr 3, 2015 · 12 comments
Closed

ie11 Promise supported? #114

hayesmaker opened this issue Apr 3, 2015 · 12 comments

Comments

@hayesmaker
Copy link

apparenlty ie11 does not support Promises so I get this issue:

SCRIPT5009: 'Promise' is undefined
File: fetch.js, Line: 244, Column: 5

   return new Promise(function(resolve, reject) {    <=====
  var xhr = new XMLHttpRequest()
  if (self.credentials === 'cors') {
    xhr.withCredentials = true;
  }

  function responseURL() {
    if ('responseURL' in xhr) {
      return xhr.responseURL
    }
@matthew-andrews
Copy link
Contributor

I think the recommendation is that developers should use a promise polyfill in conjunction with fetch (fetch shouldn't provide the polyfill itself). At my company we use either polyfill.io for this (e.g.) or ES6-Promise.

@dgraham
Copy link
Contributor

dgraham commented Apr 3, 2015

The promise polyfill is documented in the readme. We use e6-promise at GitHub.

@dgraham dgraham closed this as completed Apr 3, 2015
@hayesmaker
Copy link
Author

I've included the es6-promise:

 <script src="javascripts/vendor/fetch/fetch.js"></script>
 <script src="javascripts/vendor/es6-promise/promise.js"></script>

file, but get the same error.

@dgraham
Copy link
Contributor

dgraham commented Apr 3, 2015

Dependencies must be included in order. Try moving the promise include above fetch.

@hayesmaker
Copy link
Author

didn't matter what order I put it in.. The result was the same.
I dug around the es6-promise closed issues and someone mentioned to add this line:

 ES6Promise.polyfill()

now it works.

@mislav
Copy link
Contributor

mislav commented Apr 3, 2015

We use the pre-2.0 version of es6-promise because they broke it in v2.0: stefanpenner/es6-promise#75

@GuruAnand88
Copy link

<script type="text/javascript" src="html2canvas.js"></script> <script language="JavaScript" src="jquery.min.js" type="text/javascript"></script> <script src="es6-promise.js"></script>

The above combination worked for me

@xuqiang1227
Copy link

import ES6Promise from 'es6-promise';

ES6Promise.polyfill();

openstack-gerrit pushed a commit to openstack-infra/gerrit that referenced this issue Sep 13, 2016
Plus it is required by the fetch polyfill, see
https://github.com/github/fetch#installation

Also see JakeChampion/fetch#114

This fixes the undefined Promise error in internet explorer 11, due to
Promises not being supported in Internet explorer and other browsers.

See http://caniuse.com/#feat=promises

Bug: Issue 4308
Change-Id: I93df9c89a9a98059292038dffe1655c3f4d503c5
@markhorsman
Copy link

This is not working for me. How can I fix the undefined Promise problem? I'm using the latest version of es6-promise.

Mark Horsman

@redguardtoo
Copy link

redguardtoo commented Dec 16, 2016

Please note es6-promise is not required if you use babel+babel-runtime or babel+babel-polyfill,

The key is you MUST compile whatwg-fetch with babel so that fetch knows the babel's Promise.

Here is the snippet from my webpack.config.js,

module.exports = {
  module: {
    loaders: [
      test: /\.jsx*$/,
        // whatwg-fetch is excluded too, unfortunately.
        exclude: [/node_modules/, /.+\.config.js/],
        loader: 'babel'
      }, {
        // whatwg-fetch use Promsie which IE11 doesn't support
        test: /\.js$/,
        include: [/whatwg-.*/],
        loader: 'babel'
      }
    ]
  }
};

@mrvijaycode
Copy link

@kairi1227 I have imported as below after installed the using command npm install es6-promise

import ES6Promise from "es6-promise";
and I am getting an error saying "../node_modules/es6-promise/es6-promise" has no default export.

Please can you help me.

@balramsinghindia
Copy link

import { polyfill } from 'es6-promise'; polyfill();

Solved the purpose in my case.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 3, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants