Skip to Content
Full-Stack React Projects - Second Edition
book

Full-Stack React Projects - Second Edition

by Shama Hoque
April 2020
Intermediate to advanced
716 pages
18h 55m
English
Packt Publishing
Content preview from Full-Stack React Projects - Second Edition

Babel

Since we will be using ES6+ and the latest JS features in the backend code, we will install and configure Babel modules to convert ES6+ into older versions of JS so that it's compatible with the Node version being used.

First, we'll configure Babel in the .babelrc file with presets for the latest JS features and specify the current version of Node as the target environment.

mern-skeleton/.babelrc:

{  "presets": [    ["@babel/preset-env",      {        "targets": {          "node": "current"        }      }    ]  ]}

Setting targets.node to current instructs Babel to compile against the current version of Node and allows us to use expressions such as async/await in our backend code.

Next, we need to install the Babel modules as devDependencies from the command line:

yarn add ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Full-Stack React Projects

Full-Stack React Projects

Shama Hoque
React Native - The Practical Guide

React Native - The Practical Guide

Academind by Maximilian Schwarzmüller GmbH

Publisher Resources

ISBN: 9781839215414Supplemental Content