Answer the question
In order to leave comments, you need to log in
How to speed up gulp/rollup/babel?
Good day to all.
There is such a question. I have a JS project (using ES6) containing, in total, about 250 js files of various calibers (most within a few hundred lines). All this joy is collected by a bunch of gulp/rollup/babel like this:
var gulp = require("gulp");
var sync = require("gulp-sync")(gulp);
var babel = require("rollup-plugin-babel");
var rollup = require("rollup-stream");
var source = require("vinyl-source-stream");
var buffer = require("vinyl-buffer");
var sourcemaps = require("gulp-sourcemaps");
var cache = false;
gulp.task("js", function () {
return rollup({
entry: "src/main.js",
sourceMap: true,
plugins: [babel()],
cache: cache
})
.on("bundle", bundle => { cache = bundle; })
.pipe(source('bundle.js'))
.pipe(buffer())
.pipe(sourcemaps.init({loadMaps: true}))
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest("./build"));
});
gulp.task("watch", function () {
gulp.watch("src/**", ["js"]);
});
gulp.task("default", sync.sync(["js", "watch"]));
Answer the question
In order to leave comments, you need to log in
I don’t know if there is such a feature in rollup, but in webpack it greatly speeds up the assembly of Hot Module Replacement.
And if you want to speed up gulp, then I advise Ilya Kantor's screencast on it. https://www.youtube.com/watch?v=uPk6lQoTThE
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question