question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Promise not defined in IE 11

See original GitHub issue
  • Laravel Mix Version: 0.8.1
  • Node Version (node -v): 6.9.2
  • NPM Version (npm -v): 412
  • OS: Mac OS

Description:

Getting Promise is not defined in IE 11. Does babel not convert this by default? Where do i add the needed config to polyfill Promise?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

47reactions
scottgraysoncommented, Feb 21, 2017

Babel polyfill fixed it. I’m not using Promise myself, but its one of the packages i am importing. Mix should run on all those too right?

npm install --save babel-polyfill then in bootstrap.js //or some main js file import 'babel-polyfill'

15reactions
adiachenkocommented, Feb 21, 2017

Yes, you can simply include babel-polyfill, but unless you’re building SPA and you don’t care about the bloat of the size of another framework in your bundle, you should probably not. It’s better to require the stuff you need by hand.

It may be reasonable though to provide promise polyfill and, maybe, object-assign, out of the box. For example, this is the snippet from CRA that achieves this exact thing:

if (typeof Promise === 'undefined') {
  require('promise/lib/rejection-tracking').enable();
  window.Promise = require('promise/lib/es6-extensions.js');
}

Object.assign = require('object-assign')

This example is particularly good, because it enables rejection tracking.

UPD: In short, I don’t think encouraging the use of babel-polyfill is a great idea. But if you think that informing people on it would be too much of a pain, it’s desirable to at least include babel-polyfill from within webpack.mix.js, so that developers can easily disable implicit behavior and fall back to a more granular approach.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Getting Error Promise is undefined in IE11 - Stack Overflow
I am converting React code to typescript, target in tsconfig is es5. on running in IE 11 i get ...
Read more >
'Promise' is undefined in Internet Explorer (IE 11) - Syncfusion
We suspect that you haven't referred the ES6 Promise polyfill script in your html page which cause this issue in IE11 browser.
Read more >
"'Promise' is undefined" error in IE11 even though targeting ES5
Fails in IE 11 with error SCRIPT5009: 'Promise' is undefined . Only works in IE 11 if bluebird.min.js script element is uncommented.
Read more >
'Promise' is undefined in IE11 WordPress
I have used this plugin to create popups in the Divi website I have built: https://wordpress.org/plugins/popups-for-divi/. The popups were not opening in IE...
Read more >
JavaScript runtime error: 'Promise' is undefined in IE
While using IE11 it return JavaScript runtime error: 'Promise' is undefined in webdatarocks.js file. Please suggest resolve this issue.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found