April 2020
Intermediate to advanced
716 pages
18h 55m
English
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 ...