how to fix referenceerror regeneratorruntime is not defined code example

Example 1: ws.browser regeneratorRuntime is not defined angular

# First install the package
yarn add babel-polyfill --dev
# or
npm add babel-polyfill --dev
# Then require it in the angular.json
"scripts": ["node_modules/babel-polyfill/dist/polyfill.min.js"]

Example 2: regeneratorruntime is not defined

// In package.json add 
{
...
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }
  ...