Reputation: 157
I am getting this error when I run grunt browserify
ReferenceError: [BABEL] src/app.js: Using removed Babel 5 option: base.stage - Check out the corresponding stage-x presets http://babeljs.io/docs/plugins/#presets while parsing file: src/app.js
This is my gruntfile
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
browserify: {
main: {
options: {
browserifyOptions: {
debug: true
},
transform: [["babelify", { "stage": 1 }]]
},
src: 'src/app.js',
dest: 'scripts/app.js'
}
},
watch: {
files: [ 'src/**/*.js' ],
tasks: ['browserify'],
options: {
spawn: false,
},
},
connect: {
target:{
options: {
port: 9001
}
}
},
bower: {
flat: { /* flat folder/file structure */
dest: 'scripts',
options: {
debugging: true
}
}
}
});
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-browserify');
grunt.loadNpmTasks('main-bower-files');
grunt.registerTask('default', [ 'bower', 'connect', 'watch']);
grunt.registerTask('build', [ 'clean', 'bower', 'copy', 'uglify' ]);
};
And this is my babelrc
{
"presets": ["stage-1","es2015"]
}
How can I fix it?
Upvotes: 0
Views: 1611
Reputation: 28598
The error means that the grunt definition for babelify is obsolete and invalid.
It does not accept an option named stage
anymore.
I would try
browserify: {
main: {
options: {
browserifyOptions: {
debug: true
},
transform: [["babelify", {presets: ["stage-1", "es2015"]}]]
},
src: 'src/app.js',
dest: 'scripts/app.js'
}
},
replace {stage: 1}
with {presets: ... }
Or - since you have this defined in .babelrc
, you might be able to remove it altogether. I assume babelify applies those configurations.
Upvotes: 2