1

This morning i got an error with my NodeJS and babel configuration and i have already find the solution but i would like to understand why it happen ?

After building my app with "babel ./src -d ./lib" and then running it with "node lib/index.js" i got this error:

ReferenceError: regeneratorRuntime is not defined

I have found where is the probleme, this is about how i declared a new function:

async function loopIntercom (conversationId, splited) {
  // code.. 
}

After changing the declaration for this new one:

const loopIntercom = async (conversationId, splited) => {
  // code.. 
}

Everything working fine, but why is there a problem with the first method ?

Nestoyeur
  • 29
  • 3
  • Possible duplicate of [Using async/await with babel - require("babel-polyfill") line not at the top in built file](https://stackoverflow.com/questions/39286051/using-async-await-with-babel-requirebabel-polyfill-line-not-at-the-top-in) – Ben Avery Jul 04 '18 at 23:28

0 Answers0