Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Error: regeneratorRuntime is not defined #48

Closed
luml opened this issue Oct 18, 2019 · 2 comments
Closed

Error: regeneratorRuntime is not defined #48

luml opened this issue Oct 18, 2019 · 2 comments

Comments

@luml
Copy link

luml commented Oct 18, 2019

After I created a new file Results.js, I got a error when invoked the function requestPets():

SearchParams.js:9 Uncaught ReferenceError: regeneratorRuntime is not defined
at _requestPets (SearchParams.js:9)
at requestPets (SearchParams.js:9)
at onSubmit (SearchParams.js:44)
at HTMLUnknownElement.callCallback (react-dom.development.js:362)
at Object.invokeGuardedCallbackDev (react-dom.development.js:411)
at invokeGuardedCallback (react-dom.development.js:466)
at invokeGuardedCallbackAndCatchFirstError (react-dom.development.js:480)
at executeDispatch (react-dom.development.js:612)
at executeDispatchesInOrder (react-dom.development.js:637)
at executeDispatchesAndRelease (react-dom.development.js:743)
_requestPets @ SearchParams.js:9
requestPets @ SearchParams.js:9
onSubmit @ SearchParams.js:44
callCallback @ react-dom.development.js:362
invokeGuardedCallbackDev @ react-dom.development.js:411
invokeGuardedCallback @ react-dom.development.js:466
invokeGuardedCallbackAndCatchFirstError @ react-dom.development.js:480
executeDispatch @ react-dom.development.js:612
executeDispatchesInOrder @ react-dom.development.js:637
executeDispatchesAndRelease @ react-dom.development.js:743
executeDispatchesAndReleaseTopLevel @ react-dom.development.js:752
forEachAccumulated @ react-dom.development.js:724
runEventsInBatch @ react-dom.development.js:769
runExtractedPluginEventsInBatch @ react-dom.development.js:914
handleTopLevel @ react-dom.development.js:5848
batchedEventUpdates$1 @ react-dom.development.js:24343
batchedEventUpdates @ react-dom.development.js:1463
dispatchEventForPluginEventSystem @ react-dom.development.js:5943
attemptToDispatchEvent @ react-dom.development.js:6059
dispatchEvent @ react-dom.development.js:5963
unstable_runWithPriority @ scheduler.development.js:815
runWithPriority$2 @ react-dom.development.js:12188
discreteUpdates$1 @ react-dom.development.js:24359
discreteUpdates @ react-dom.development.js:1486
dispatchDiscreteEvent @ react-dom.development.js:5926

Later I figured out, I added a extra import at SearchParams.js

import regeneratorRuntime from "./../node_modules/regenerator/runtime.js";

Not sure if it happend to anyone?

@mantismamita
Copy link

I think babel is adding a polyfill because of the list of supported browsers. If you shorten your list to use only the Chrome and Firefox (unless you are using something else) you can get rid of the error without having to import anything into SearchParams.js

Otherwise as you said you can
import regeneratorRuntime from "regenerator/runtime.js";

but your eslint won't love you for it 😉

Also be sure to re-run npm run dev after altering the list.

@luml
Copy link
Author

luml commented Oct 21, 2019

@mantismamita Thank you, you're right. Also there're more explanation in closed issues.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants