What is regenerator-runtime npm package used for?
I’ve noticed it in my company’s codebase and it has 30M downloads per week so I’m curious about its importance.
regenerator-runtime
is the runtime support for compiled/transpiled async
functions. (It may well have other uses, but this is the predominant one.)
When you use a compiler like Babel that compiles modern JavaScript into earlier JavaScript (a process sometimes called transpiling), one of the things you can do is compile async
functions to something that will run on JavaScript engines that don’t support async
functions (such as the increasingly-irrelevant IE11). Babel does the syntax transformation, but the resulting code relies on runtime support from regenerator-runtime
.
The answers/resolutions are collected from stackoverflow, are licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0 .