gaearon / react-hot-loader

Tweak React components in real time. (Deprecated: use Fast Refresh instead.)

Home Page:http://gaearon.github.io/react-hot-loader/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

IE11 throw Promise is undefined

silaike opened this issue · comments

Description

IE11 throw Promise is undefined

Expected behavior

Promise should be polyfilled.

Actual behavior

IE11 throws any error in console.

Environment

React Hot Loader version: 4.13.0

Reproducible Demo

it works fine in 4.12.x

React-Hot-Loader is not expected to work with IE11, as the latter was deprecated roughly a year ago.
However, there is question about polyfill and it's presence in your codebase

  • if it is missing - please add, library cannot do it
  • if it is not missing, but by any reason not applied before RHL uses Promises - that's a bug.

polyfill is not missing in my code, it works fine in React Hot Loader version: 4.12.x.

in React Hot Loader version: 4.13.0, it's throwing the error here:

Promise.resolve(incrementHot()).then(() => setTimeout(decrementHot, 0));

That code was not changed in a last few years, the question is why this code is called before(?) polyfill initilization (so that sounds like a bug)

I am having same issue.

webpack.config.js

    entry: [
      '@babel/polyfill',
      path.resolve(__dirname, './src/global/scripts/polyfills.js'),
      'react-hot-loader/patch',
      path.resolve(__dirname, './src/index.js'),
    ],

please double-check that RHL is not patching your polyfills. Or even easier - check the stack trace of the error to find the file it's originated, and the position of that file in entry scripts.