I have this simple code on my gruntfile.js:
module.exports = function (grunt)
{
require("load-grunt-tasks")(grunt); // npm install --save-dev load-grunt-tasks
grunt.initConfig({
babel: {
options: {
sourceMap: true
},
dist: {
files: {
"dist/app.js": ["src/app.js"]
}
}
}
});
grunt.registerTask("default", ["babel"]);
};
But show me this error when run:
Warning: Task "babel" not found. Use --force to continue.
Aborted due to warnings.
Process finished with exit code 3
Any help? Never convert from ecmascript 6 to 5 :(
Here My files:
.zip
I have this simple code on my gruntfile.js:
module.exports = function (grunt)
{
require("load-grunt-tasks")(grunt); // npm install --save-dev load-grunt-tasks
grunt.initConfig({
babel: {
options: {
sourceMap: true
},
dist: {
files: {
"dist/app.js": ["src/app.js"]
}
}
}
});
grunt.registerTask("default", ["babel"]);
};
But show me this error when run:
Warning: Task "babel" not found. Use --force to continue.
Aborted due to warnings.
Process finished with exit code 3
Any help? Never convert from ecmascript 6 to 5 :(
Here My files:
http://www.mediafire.com/download/nabq78bs323u47b/DemoBable.zip
Share Improve this question edited Nov 19, 2015 at 3:55 Braiam 4,49611 gold badges49 silver badges83 bronze badges asked Nov 19, 2015 at 1:26 ChelendezChelendez 1631 silver badge9 bronze badges 5- also try to explain what you're trying to do – davejal Commented Nov 19, 2015 at 1:35
- I want traslate javascript ecma 6 (game.jsx) to ecma 5 using babel – Chelendez Commented Nov 19, 2015 at 1:37
- can you share all files in your project? – Nguyen Sy Thanh Son Commented Nov 19, 2015 at 2:12
- Yes here : mediafire.com/download/nabq78bs323u47b/DemoBable.zip – Chelendez Commented Nov 19, 2015 at 3:06
- Please read tag descriptions! babel is for questions about a Python library with the same name. – Felix Kling Commented Nov 19, 2015 at 3:53
1 Answer
Reset to default 20I downloaded your code to try to help you. I did it. Please see my steps belows:
Step 1: Go to the root project directotry
cd DemoBable
Step 2: Install grunt
npm install --save-dev grunt
Step 3: Install load-grunt-tasks
npm install --save-dev load-grunt-tasks
Step 4: Install grunt-babel
npm install --save-dev grunt-babel
Step 5: Finaly, run it
grunt
The output should be:
Running "babel:dist" (babel) task
Done, without errors.
EDITED
To convert to code to ecma 5. Your gruntfile.js
should be:
module.exports = function (grunt)
{
require("load-grunt-tasks")(grunt); // npm install --save-dev load-grunt-tasks
grunt.initConfig({
"babel": {
options: {
sourceMap: true,
presets: ['es2015']
},
dist: {
files: {
"dist/app.js": "src/app.js"
}
}
}
});
grunt.registerTask("default", ["babel"]);
};
And you have to install babel-preset-es2015
:
npm install --save-dev babel-preset-es2015