1

I've recently removed @babel/polyfill to use core-js@3.

When building my project webpack states:

Based on your code and targets, added regenerator-runtime

and it then fails when it cannot be resolved.

So i install the regenerator-runtime package and everything works.

But I'm not entirely sure why this doesn't work without that package? Can anyone point me in the direction of some good reading? My googling hasn't thrown the right results up

NickW
  • 1,207
  • 1
  • 12
  • 52
  • 1
    Does this answer help you? https://stackoverflow.com/questions/33527653/babel-6-regeneratorruntime-is-not-defined/56754212#56754212 (Disclaimer: I am the author). It should target exactly your problem. – ford04 Aug 01 '19 at 15:18
  • 1
    PS: Not sure if its a duplicate, as the other post technically has still a "Babel 6" label in the title. But contents go beyound version 6 and are related to regenerator/core-js – ford04 Aug 01 '19 at 15:19
  • 1
    I'd got to the point of your first answer so yes I think that answer in particular is a dupe. In general I was more interested though in the why/what exactly is happening, as I'm pretty new to Babel. I'll have a read through that thread though, thanks – NickW Aug 01 '19 at 15:22
  • 1
    Short story: you need the regenerator-runtime as a dependency, if you target older browser versions that do not support async-generators in javascript. If I remember correctly, @babel/preset-env per default tries to cover all browsers which have >0.25% market share (via browserlist). – ford04 Aug 01 '19 at 15:30

0 Answers0