It drives me crazy, so I hope someone sees what I miss. Thank you for your help.
I have a gulp file and I installed it through npm, babel-core, babel-preset-es2015, babel-preset-react. From online research and in high hopes, although this may not be the case, I renamed the gulp file to the gulpfile.babel.js file, and I created the .babelrc file with
{ "presets": ["es2015"] }
I use browsers and when I run the gulp task, the html file is loaded, but in index.js I have "import React ....". These files cause an error in the JS console that says: "Unused SyntaxError: Unexpected token import."
I thought the es2015 npm packages I have should take care of this ES6 syntax?
In the gulp file, the task I was thinking about had to take care of this:
// convert jsx to JS gulp.task('babelFiles', function() { return gulp.src('js/*.(jsx|js)') .pipe(babel({ compact: false })) .pipe(gulp.dest('js')) .pipe(browserSync.reload({ stream: true })) });
The gulp task that is responsible for its launch:
// Default task gulp.task('default', ['babelFiles', 'browserSync']);
I am puzzled by what might be wrong here?
Any ideas would be greatly appreciated!
ecmascript-6 npm gulp babel
mm2887
source share