Answer the question
In order to leave comments, you need to log in
How to set up babel along with gulp?
Hello. You need to configure babel so that the necessary polyfills are loaded via gulp. The intuitive documentation hasn't given me an answer to this question for a day now.
Needed: support for all new js features (ES19), converting them to ES5. support for promises, methods such as Object.values, Array.Flat(), etc., support for legacy code, i.e. lack of "strict mode". I would like to get 1 js file at the output, which is already ready for use in production.
What is now:
return gulp.src(files)
.pipe(sourcemaps.init())
.pipe(babel({presets: , plugins: ["transform-remove-strict-mode", "transform-runtime"], compact: true}))
.pipe(concat(config.name + '.min.js'))
.pipe(uglify())
.on('error', function (err) { gutil.log(gutil.colors.red('[Error]'), err.toString()); })
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest(__dirname + '/Builds'));
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question