Light Babel Node Config

Table of Content

Light Babel Node Config

Source from rw;eruch

What is this?

This post is personal reference

The other day I started building an APi first project with Node and express and I have become so accustom out of the box support for ES6 for the last few years using Create React APP, or hoping into a CodeSandBox that when import express from 'express' exploded I was a little taken aback…😊

Naturally I Googled “Nodejs Babel Config” and the one I liked was rw;eruch - Minimal Nodejs Babel Setup. Being particularly lazy and also aware that I have configured a node project for ES6 a thousand times. I quickly scrolled to the few command I needed which are listed below.

The Commands and Files

npm i --save-dev nodemon @babel/core @babel/node @babel/preset-env

.babelrc

{
  "presets": [
    "@babel/preset-env"
  ]
}

package.json

...
"scripts: {
  ...
  "dev": "nodemon --exec babel-node app.js"
  ...
}
....

Notes:

In this particular project I ended up using webpack for my build due to the way Heroku handles deployment.