react-aad icon indicating copy to clipboard operation
react-aad copied to clipboard

Unhandled Rejection (ReferenceError): regeneratorRuntime is not defined

Open kiranbhadani opened this issue 5 years ago • 6 comments

Library versions

  • react-aad-msal: 2.3.5
  • msal: 1.3.1

Describe the bug Unhandled Rejection (ReferenceError): regeneratorRuntime is not defined After upgrade npm package from 2.1.1 on a react app

kiranbhadani avatar May 20 '20 11:05 kiranbhadani

@kiranbhadani provide the entire stack trace

TissonMathew avatar May 20 '20 16:05 TissonMathew

Stack trace

image

kiranbhadani avatar May 22 '20 13:05 kiranbhadani

MSAL uses unpolyfilled promises, and I believe by extension, so does react-aad-msal. I need to add a note to the documentation for this, but for now you will need to polyfill.

AndrewCraswell avatar May 26 '20 19:05 AndrewCraswell

@kiranbhadani can you try it? thanks @AndrewCraswell

TissonMathew avatar May 26 '20 20:05 TissonMathew

@AndrewCraswell Not sure how to apply 'polyfill', I managed to upgrade the package by installing all npm dependencies (copying from sample app) and importing regenerator-runtime

Dependencies add to package.json "velocity-animate": "^1.5.2", "@babel/core": "7.8.4", "@svgr/webpack": "4.3.3", "@testing-library/jest-dom": "^4.2.4", "@testing-library/react": "^9.3.2", "@testing-library/user-event": "^7.1.2", "@typescript-eslint/eslint-plugin": "^2.10.0", "@typescript-eslint/parser": "^2.10.0", "babel-eslint": "10.0.3", "babel-jest": "^24.9.0", "babel-loader": "8.0.6", "babel-plugin-named-asset-import": "^0.3.6", "babel-preset-react-app": "^9.1.1", "camelcase": "^5.3.1", "case-sensitive-paths-webpack-plugin": "2.3.0", "css-loader": "3.4.2", "dotenv": "8.2.0", "dotenv-expand": "5.1.0", "eslint": "^6.6.0", "eslint-config-react-app": "^5.2.0", "eslint-loader": "3.0.3", "eslint-plugin-flowtype": "4.6.0", "eslint-plugin-import": "2.20.0", "eslint-plugin-jsx-a11y": "6.2.3", "eslint-plugin-react": "7.18.0", "eslint-plugin-react-hooks": "^1.6.1", "file-loader": "4.3.0", "fs-extra": "^8.1.0", "html-webpack-plugin": "4.0.0-beta.11", "identity-obj-proxy": "3.0.0", "jest": "24.9.0", "jest-environment-jsdom-fourteen": "1.0.1", "jest-resolve": "24.9.0", "jest-watch-typeahead": "0.4.2", "mini-css-extract-plugin": "0.9.0", "optimize-css-assets-webpack-plugin": "5.0.3", "pnp-webpack-plugin": "1.6.0", "postcss-flexbugs-fixes": "4.1.0", "postcss-loader": "3.0.0", "postcss-normalize": "8.0.1", "postcss-preset-env": "6.7.0", "postcss-safe-parser": "4.0.1", "react-app-polyfill": "^1.0.6", "react-dev-utils": "^10.2.0", "react-redux": "^7.1.3", "redux": "^4.0.5", "resolve": "1.15.0", "resolve-url-loader": "3.1.1", "sass-loader": "8.0.2", "semver": "6.3.0", "style-loader": "0.23.1", "terser-webpack-plugin": "2.3.4", "ts-pnp": "1.1.5", "url-loader": "2.3.0", "webpack": "4.41.5", "webpack-dev-server": "3.10.2", "webpack-manifest-plugin": "2.2.0", "workbox-webpack-plugin": "4.3.1"

import regenerator-runtime in index.js import 'regenerator-runtime/runtime'

Can you confirm that is that correct way, do i need all these dependecies?

kiranbhadani avatar May 27 '20 05:05 kiranbhadani

I solved this by adding: import "regenerator-runtime/runtime" in my authProvider.js

henriktorget avatar Jun 30 '20 12:06 henriktorget