S
S
sugadu2016-08-17 21:09:35
JavaScript
sugadu, 2016-08-17 21:09:35

How to configure babel to use asyn/cawait in node.js?

Babel has a lot of settings, presets and plugins. Nowhere is there a sensible tutorial on setting it up. Some write to use "babel-cli", others just "babel", others "babel-node". At the same time, you can still configure presets and plugins in different ways.
Tell me what you need to install and configure in order to use ES6 syntax and async/await in node?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Aves, 2016-08-17
@sugadu

package.json

{
  "dependencies": {
    "babel-core": "latest",
    "babel-preset-es2015-node6": "latest",
    "babel-preset-stage-3": "latest",
    "babel-register": "latest"
  },
  "babel": {
    "presets": [
      "es2015-node6",
      "stage-3"
    ]
  },
  "scripts": {
    "start": "node -r babel-register server.js"
  }
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question