1@babel/core: A fundamental package to run any babel setup/configuration.
2@babel/cli:A built-in CLI which can be used to compile files from the command line/terminal.
3@babel/node:is a CLI that works the same as the Node.js CLI, with the added benefit of compiling with Babel presets and plugins before running it.
4@babel/preset-env(dev): is a smart preset that allows you to use the latest JavaScript .
5@babel/plugin-transform-runtime(dev):A plugin that enables the re-use of Babel's injected helper code to save on code size.
6@babel/runtime(save): a package to be installed production dependency to avoid duplication across your compiled output.
7
8// yarn add
9@babel/node @babel/preset-env @babel/plugin-transform-runtime @babel/runtime
10
11// .babelrc
12{
13 "presets": ["@babel/preset-env"],
14 "plugins": [
15 ["@babel/plugin-transform-runtime"]
16 ]
17}
18
19// package.json
20"scripts": {
21 "start": "npm run build && node ./build/src/server.js",
22 "dev": "nodemon --exec babel-node ./src/server.js",
23 "clean": "rm -rf build && mkdir build",
24 "build-babel": "babel ./src -d ./build/src",
25 "build": "npm run clean && npm run build-babel"
26}
1// yarn add @babel/cli @babel/core @babel/node @babel/plugin-transform-runtime @babel/preset-env --dev
2// yarn add @babel/runtime
3"dependencies": {
4 "@babel/runtime": "^7.15.4" //a package to be installed production dependency to avoid duplication across your compiled output.
5 },
6 "devDependencies": {
7 "@babel/cli": "^7.15.7", // A built-in CLI which can be used to compile files from the command line/terminal.
8 "@babel/core": "^7.15.5", // a fundamental package to run any babel setup/configuration
9 "@babel/node": "^7.15.4", //babel-node is a CLI that works the same as the Node.js CLI, with the added benefit of compiling with Babel presets and plugins before running it.
10 "@babel/plugin-transform-runtime": "^7.15.0", // A plugin that enables the re-use of Babel's injected helper code to save on code size.
11 "@babel/preset-env": "^7.15.6" // is a smart preset that allows you to use the latest JavaScript without needing to micromanage which syntax transforms (and optionally, browser polyfills) are needed by your target environment(s).
12 }
13
14// package.json
15"scripts": {
16 "start": "yarn run build && node ./build/src/index.js",
17 "start:dev": "/node_modules/.bin/babel-node ./src/index.js",
18 "clean": "rm -rf build && mkdir build",
19 "build-babel": "babel ./src -d ./build/src",
20 "build": "yarn run clean && yarn run build-babel"
21 }
22
23// .babelrc
24{
25 "presets": ["@babel/preset-env"],
26 "plugins": [
27 ["@babel/plugin-transform-runtime"]
28 ]
29}
30
31