I am using babel to transpile my es6 code to es5 in node application.
I have used below babel node modules for this
"babel-cli": "6.24.0"
"babel-preset-es2015": "6.24.0"
"babel-preset-stage-2": "6.22.0"
And below is related configuration in package.json
{
"name": "twinconsole",
"version": "1.1.0",
"description": "",
"main": "dist/index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"prebuild": "rimraf dist",
"build": "babel --out-dir dist src"
},
"author": "'[email protected]'>",
"license": "MIT",
"devDependencies": {
"babel-cli": "6.24.0",
"babel-preset-es2015": "6.24.0",
"babel-preset-stage-2": "6.22.0",
"rimraf": "2.6.1"
},
"config": {
"babel": {
"presets": ["es2015" , "stage-2"]
}
}
}
I was expecting below es6 code which uses Arrow function
module.exports.print = msg => {
console.log(msg);
}
to be transpiled to
module.exports.print = function(msg) {
console.log(msg);
}
Instead the transpiled code still has arrow function.
Any idea what could be the issue.