I'm trying to transpile es6 to es5 but it is not working.
My Gruntfile.js
module.exports = function(grunt){
"use strict";
grunt.loadNpmTasks('grunt-babel');
grunt.initConfig({
"babel": {
options: {
sourceMap: true
},
dist: {
files: {
"dist/app.js": "app.js"
}
}
}
});
grunt.registerTask("default", ["babel"]);
}
when I run grunt the file dist/app.js is the the same off app.js
Is anything wrong?
I found the error.
I had to intall babel-preset-es2015 : npm install -D babel-preset-es2015
and config the babel inside package.json.
{
"name": "babel",
"version": "0.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"babel": {
"presets": [
"es2015"
]
},
"author": "",
"license": "ISC",
"devDependencies": {
"babel-cli": "^6.1.18",
"babel-preset-es2015": "^6.1.18",
"babelify": "^7.2.0",
"grunt": "^0.4.5",
"grunt-babel": "^6.0.0",
"grunt-browserify": "^4.0.1",
"grunt-contrib-watch": "^0.6.1",
"load-grunt-tasks": "^3.3.0"
}
}