How to use babel 7 in node project

Issue #650

Install

1
2
3
npm install @babel/core
npm install @babel/cli
npm install @babel/preset-env

Configure .babelrc

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

In package.json, transpile using npx babel then node dist/index.js

1
"start": "cp ../landing/src/apps/factory.js copied/factory.js && npx babel index.js --out-file dist/index.js && npx babel copied/factory.js --out-file dist/factory.js && node dist/index.js"

Comments