Node.js Babel 7.x different usage transpiling to ES5 and Debugging

I already mentioned many details in the following link. So I don't want to duplicate everything in this post one more time.

You can reach github project from the following link.

https://github.com/kenanhancer/babel7-usage.git

You can reach Babel 6.x post from the following link.

Creating Babel configuration file

.babelrc

{
  "presets": [
    "@babel/preset-env",
    "@babel/preset-react"
  ],
  "plugins": [
    "@babel/plugin-transform-runtime"
  ],
  "env": {
    "development": {
      "presets": [
        [
          "@babel/preset-react",
          {
            "development": true
          }
        ]
      ],
      "sourceMaps": true,
      "retainLines": true
    }
  }
}

Node.js Babel 6.x different usage transpiling to ES5 and Debugging

There are different usages of babel tool. I put a sample package.json file. Notice that there are scripts block which has different usages.

You can reach github project from the following link.

https://github.com/kenanhancer/babel6-usage.git

You can reach Babel 7.x post from the following link.

Creating Babel configuration file

.babelrc

{
  "presets": [
    "env"
  ],
  "plugins": [
    "transform-runtime"
  ],
  "sourceMaps": true,
  "retainLines": true
}

Running with Babel-node

//If you have installed babel-cli package globally, run below code.
babel-node --presets=env --plugins=transform-runtime src

or

//If you have .babelrc config file, run below code without specifying inline arguments.
babel-node src

or

//If you have installed babel-cli package locally, run below code.
./node_modules/.bin/babel-node --presets=env --plugins=transform-runtime src
Continue reading