Friday 19 May 2017

Different ways to require 'babel-register'

In src/index.js:

async function main() {}
main()

In .babelrc:

{
  "presets": ["env"]
}

When running node -r babel-register src/index.js:

ReferenceError: regeneratorRuntime is not defined

However, when I explicitly add require('babel-register') to the top of index.js, the script runs successfully.

What's the difference here?



via damd

No comments:

Post a Comment