You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ReferenceError: regeneratorRuntime is not defined #71
// somewhere.tsimport*asQueueWorkerfrom"../queue.worker"constworker=(QueueWorkerasany)()astypeofQueueWorker// somewhere in the fileawaitworker.getShuffledTracks(...)
Then, when the function is called, I get this error:
This is what the config for the loader looks like:
Knowing that workers and your main thread are completely seperate, it's reasonable to assume you'd need to do this in your worker code too. So I added import '@babel/polyfill'; as the very first line of my worker file. This seems to have worked, but I don't guarantee this is the proper fix.
tl;dr Try adding import '@babel/polyfill'; or import 'react-app-polyfill/ie11'; import 'react-app-polyfill/stable'; as the very first line of your worker file.
Activity
bsherrill480 commentedon Aug 13, 2019
So from what I understand, for webpack to let your code use async, your code needs to explicity import a polyfill. My current code is using babel/polyfill, but I believe that's been deprecated so maybe try https://github.com/facebook/create-react-app/tree/master/packages/react-app-polyfill instead?
Knowing that workers and your main thread are completely seperate, it's reasonable to assume you'd need to do this in your worker code too. So I added
import '@babel/polyfill';as the very first line of my worker file. This seems to have worked, but I don't guarantee this is the proper fix.tl;dr Try adding
import '@babel/polyfill';orimport 'react-app-polyfill/ie11'; import 'react-app-polyfill/stable';as the very first line of your worker file.developit commentedon Aug 15, 2019
Yup, make sure to import a polyfill your code depends on.
cstsortan commentedon Oct 9, 2019
What about typescript? There's still a similar error there
developit commentedon Nov 26, 2019
import regenerator in your worker file: