I’m having trouble with my gulp build process after reinstalling my project dependencies. Everything was working fine before, but now I get a compilation error when running my babel task through gulp.
The error message shows:
SyntaxError: main.js: Unexpected token (125:8)
The problematic code line is:
124 | response,
> 125 | sync = false,
| ^
126 | timeout = 5000,
127 | type = 'POST',
128 | requestHeaders = {},
What’s weird is that when I run babel directly from command line on the same file, it works perfectly and produces the expected output.
Here’s my gulp configuration:
const gulp = require('gulp');
const plugins = require('gulp-load-plugins')();
gulp.task('transform', () => {
return gulp.src([
'src/main.js'
]).pipe(plugins.babel()).pipe(gulp.dest('dist'));
});
My babel config file:
{
"presets": ["es2016"],
"plugins": [
"transform-es2015-arrow-functions",
"transform-es2015-object-super",
"transform-es2015-parameters",
"transform-object-assign",
"transform-es2015-block-scoping",
"transform-es2015-shorthand-properties",
"transform-es2015-block-scoped-functions",
"transform-es2015-for-of",
"transform-es2015-destructuring",
["transform-es2015-classes", {"loose": true}],
["transform-es2015-spread", {"loose": true}],
["transform-es2015-template-literals", {"loose": true}]
]
}
Any ideas what could be causing this issue?