react-hot-loader: Uncaught TypeError: reactLifecyclesCompat.polyfill is not a function

If you are reporting a bug or having an issue setting up React Hot Loader, please fill in below. For feature requests, feel free to remove this template entirely.

Description

What you are reporting: While upgrading to react-hot-loader 4.1.2, I get the following runtime error in the browser console: Uncaught TypeError: reactLifecyclesCompat.polyfill is not a function

When I look into the dist code in my node-modules folder, I see the following line failing: reactLifecyclesCompat.polyfill(AppContainer);, line 1440 in react-hot-loader.development.js.

The original source code is here: https://github.com/gaearon/react-hot-loader/blob/948138ace84d08c95f29870b1e461154f1208cc7/src/AppContainer.dev.js#L66

It seems the code is not transpiled into ES5.1 correctly. Correct me if I’m wrong.

If I change line 1440 in the dist version to reactLifecyclesCompat(AppContainer); everything runs as expected and my app works again.

Expected behavior

The code should run out of the box with no errors.

Actual behavior

The code fails to run since the function polyfill doesn’t exist in reactLifecyclesCompat, but is exported as that module itself, as seen here in the source code: https://github.com/reactjs/react-lifecycles-compat/blob/e4e21a682361c6d580508fb5cfd33d265bb800cf/index.js#L47

Environment

React Hot Loader version: 4.1.2

Run these commands in the project folder and fill in their results:

  1. node -v: v8.9.4

  2. npm -v: 5.6.0

Then, specify:

  1. Operating system: macOS Sierra 10.12.6
  2. Browser and version: Chrome, version 65.0.3325.181

Thanks

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 1
  • Comments: 16

Commits related to this issue

Most upvoted comments

Clearing node_modules and removing package-lock.json helps for me

Not reproducible.