简体   繁体   中英

Can't find variable: regeneratorRuntime (ReactNative)

While trying to run my project on an android emulator, the device throws this error emulator screenshot . I cannot seem to figure out what I am doing wrong. I am still quite new to react

firstly install babel polyfill

npm install --save @babel/polyfill

then import on top of index.js .

i mean on very top before any import

import "@babel/polyfill";

if got no answer so

module.exports = {
entry: ["@babel/polyfill", "./app/js"],
};

use it this way on your webpack.config.js

For anyone coming across this post later, @babel/polyfill has been deprecated in favour of core-js . See https://babeljs.io/docs/en/babel-polyfill

If you're using >7.4.0 babel, you should be able to configure this using @babel/env . Set your targets in .babelrc (or whatever you call your babel config)

{
"presets": [
  [
  "@babel/env",
    {
      "targets": {
        "edge": "17",
        "firefox": "60",
        "chrome": "67",
        "safari": "11.1"
        }
      }
    ]
  ]
}

https://babeljs.io/docs/en/usage#configuration

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM