我在上面安装了gulp-babel:
npm install --save-dev gulp-babel babel-core babel-preset-env babel-polyfill
然后我在gulpfile.js中插入了gulp.task
gulp.task('polyfill', function () {
return gulp.src(`${distDir}js/file.js`)
.pipe(babel({
presets: [
[
"@babel/preset-env",
{
"targets": {
"chrome": "58",
"ie": "11"
}
}
]
]
}))
.pipe(gulp.dest(`${distDir}`))
});
polyfill任务正在运行,但运行任务后文件不是IE11符合
。谢谢。