Wednesday 17 May 2017

NodeJS, babel build -> regeneratorRuntime is not defined

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 ?



via Nestoyeur

No comments:

Post a Comment