Create a node server with es6 support
yarn add --dev @babel/core @babel/cli @babel/preset-env @babel/node nodemon
add this to your package.json file
"scripts": {
"dev": "nodemon --exec babel-node src/index.js",
"build": "babel src --out-dir dist",
"start": "node dist/index.js"
},
this will run babel and output the files into a build folder. when you run yarn build
it will serve the files when you run yarn start
- this is for production
it will deploy locally and rebuild the transpiled code when you run yarn dev
and in .babelrc
{
"presets": ["@babel/preset-env"]
}