I want to transpile pure js code in gulp using babel. But there is a variable "interface" in my code. For example
function func(interface) {
console.log(interface)
}
How can I fix this?
Packages versions
"@babel/core": "^7.14.6",
"@babel/preset-env": "^7.14.5",
"gulp": "^4.0.2",
"gulp-babel": "^8.0.0",
My gulp task
function transpileJs() {
return gulp.src(['folder/**/*.js'])
.pipe(babel({
presets: ['@babel/preset-env'],
}))
.pipe(gulp.dest('folder/dest/'));
}
Thanks for the help
The word "interface" is a reserved in "strict mode". That's why you cannot use it as an identifier to declare any variable or function parameter.
Rename you function parameter and the problem will go away.