Home:ALL Converter>Switching from babel-polyfill to core-js in React app

Switching from babel-polyfill to core-js in React app

Ask Time:2020-05-02T06:58:49         Author:Sam

Json Formatter

I use babel-polyfill in my React app to transpile ECMAScript to vanilla JS. I understand babel-polyfill is now deprecated.

The warning I get in my React app is:

@babel/polyfill is deprecated. Please, use required parts of core-js and regenerator-runtime/runtime separately

I currently have the following in my package.json file:

"devDependencies": {
    "babel-polyfill": "^6.26.0",
    "redux-devtools": "^3.5.0"
  }

Is it safe to assume that I'll need to have the following now instead of babel-polyfill?

"devDependencies": {
    "core-js": "3.6.5",
    "regenerator-runtime": "0.13.5"
  },

Also, I think, instead of import 'babel-polyfill'; in my reducers and components, I think I'll need the following:

import "core-js/stable";
import "regenerator-runtime/runtime";

Are these the steps to go through? Am I missing anything?

Author:Sam,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/61552097/switching-from-babel-polyfill-to-core-js-in-react-app
yy