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.

IE support: "'Promise' is undefined", bundles fail to load

See original GitHub issue

šŸ› bug report

Loading the dev server output in IE11 keeps bundles from loading. It’s a hard stop that prevents the base page from even attempting to continue.

Note: This is from what’s generated by parcel, not my app source code or my dependencies. See this comment below.

šŸŽ› Configuration (.babelrc, package.json, cli command)

.babelrc

The app works in FF + Chrome (used --no-cache) without the custom .babelrc.

{
  "presets": [
    [
      "env",
      {
        "modules": false,
        "targets": {
          "browsers": [
            "> 1%",
            "last 2 versions",
            "ie 11",
            "not ie <= 10"
          ]
        }
      }
    ]
  ]
}


package.json

here's the full package.json, below is the scripts and deps only

  "scripts": {
    "clean": "rimraf dist",
    "dev": "parcel src/index.html",
    "build": "run-s clean build:raw",
    "build:raw": "parcel build --public-url . src/index.html",
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "devDependencies": {
    "babel-core": "^6.26.3",
    "babel-preset-env": "^1.7.0",
    "npm-run-all": "^4.1.5",
    "parcel-bundler": "^1.10.3",
    "rimraf": "^2.6.2"
  },
  "browserslist": [
    "> 1%",
    "last 2 versions",
    "ie 11",
    "not ie <= 10"
  ]


I start the local server with npm run dev, which invokes parcel ./src/index.html.

Note: my package.json includes the relevant browserslist, which specifies IE 11.

šŸ¤” Expected Behavior

Bundles should load correctly, including in IE 11.

😯 Current Behavior

Bundled app stops loading in IE11 almost immediately. Cites ā€œā€˜Promise’ is undefinedā€ in JS console, clicking to the line number points to the loadBundles function, which returns Promise.all(bundles.map(loadBundle)).

Also used by Parcel’s generated main js file, Promise.resolve and fetch. Specifying IE 11 support for targeted browser should ensure that no un-polyfilled APIs are used (Promise, fetch).

Raw console error:

SCRIPT5009: 'Promise' is undefined
main.1f19ae8e.js 394,27)

parcel_ie_issues

šŸ’ Possible Solution

From the other linked ā€œie supportā€ descriptions in the changelog and the corresponding culprits, it looks like this is has to do fundamentally with the un-polyfilled Promise and global objects, such as fetch referenced when attempting to load necessary bundles. The loadBundles fires before my app logic, so no polyfilling on my end will affect the outcome. By performing a build of my repro with manually added polyfills into the head tag for Promise and fetch, this worked; but this isn’t something I should have to do.

šŸ”¦ Context

For my work apps am required to support IE11. I believe this should be achievable w/ parcel, but ran into some trouble. The app works great in Chrome and Firefox. The issues I’m experiencing deal with Parcel’s direct use of Promise and fetch directly in the initialization of bundles from the built main.<hash>.js.

šŸ’» Code Sample

I have an example repo:

https://github.com/edm00se/parcel-ie11-issue-demo

Steps to reproduce:

  • git clone https://github.com/edm00se/parcel-ie11-issue-demo.git
  • cd parcel-ie11-issue-demo
  • npm install
  • npm run dev
  • open http://localhost:1234 in IE 11
  • have a look at the js console, since the screen is blank (screen shots above)

šŸŒ Your Environment

Software Version(s)
Parcel 1.10.3
Node 10.13.0
npm/Yarn 6.4.1
Operating System Windows 10

Thank You!

I love parcel, it’s a great and performant bundler that’s enjoyable to use. When I set out on this crazy path, I wasn’t expecting to get as far as I have, and I am 99.8% there!

*note: I’ve updated this description to point to a far more simple reproducible repo

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:9
  • Comments:25 (2 by maintainers)

github_iconTop GitHub Comments

17reactions
tomasdevcommented, May 6, 2019

What’s the point on even having browserslist if it won’t work as expected.

13reactions
edm00secommented, Jan 22, 2019

For any interested in this issue, I threw together a parcel plugin to add high level polyfills for both Promise and fetch to keep parcel’s bundle loader working in IE(11).

repo: https://github.com/edm00se/parcel-plugin-goodie-bag use: npm i -S parcel-plugin-goodie-bag (auto loads into index.html on build/dev)

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
Hi! Trying to run a .NET Core 2.0 Web App with Syncfusion J2 Controls (Grid/Schedule etc.) and keep getting the following error only...
Read more >
Promise is undefined error on loading the Report Viewer in ...
Trying to load a page with a HTML5 Report Viewer in it on a browser that does not support promises, will lead to...
Read more >
Is your Vue app not working in IE 11? Here's how to fix it.
Sometimes it can be incredibly hard to trace the true source of the error in your Vue code. This is because Webpack bundles...
Read more >
Promise Is Undefined for PnP Js core SharePoint - IE & Edge ...
PnPjs uses some browser APIs, which are not supported in IE\Edge. You should install polyfills in order to support them.
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