由于内存堆栈,每次执行时Gulp执行时间都会增加

时间:2019-06-12 14:23:08

标签: gulp browser-sync gulp-sass

由于gulpfile.js配置可能不正确,我遇到了一个问题。 当我开始大吃一口时,一切都很好,但每次运行 任务执行时间增加。

我正在使用:

  • clean-css
  • 无礼
  • 观看
  • 源地图

我的gulpfile.js配置:

let gulp        = require('gulp'),
    cleanCSS    = require('gulp-clean-css'),
    sass        = require('gulp-sass'),
    watch       = require('gulp-watch'),

    sourcemaps  = require('gulp-sourcemaps'),
    rename      = require('gulp-rename');

let browserSync = require('browser-sync').create();

// browserSync and files watcher
gulp.task('sync', () => {

    browserSync.init({
        proxy: environmentPath
    });

    gulp.watch(sassWatcher, gulp.series('sass'));
    gulp.watch(jsWatcher).on('change', browserSync.reload);    
    gulp.watch(htmlWatcher).on('change', browserSync.reload);
});

// development sass output, with browserSync and sourcemaps
gulp.task('sass', () => {
    return gulp.src(sassDevFile)
        .pipe(sourcemaps.init({loadMaps: true}))
        .pipe(sass().on('error', sass.logError))

        .pipe(sourcemaps.write())
        .pipe(gulp.dest(sassOutputFolder))
        .pipe(browserSync.stream())
});

几次执行任务后,我得到此错误:

[15:48:19] Finished 'sass' after 3.65 s

<--- Last few GCs --->

[17940:00000161B594A100]  1604145 ms: Scavenge 52.8 (61.2) -> 52.0 (62.2) MB, 2.7 / 0.0 ms  (average mu = 0.997, current mu = 0.978) allocation failure
[17940:00000161B594A100]  1604176 ms: Scavenge 53.4 (62.2) -> 52.7 (62.7) MB, 21.7 / 0.0 ms  (average mu = 0.997, current mu = 0.978) allocation failure
[17940:00000161B594A100]  1604223 ms: Scavenge 54.0 (62.7) -> 53.3 (63.2) MB, 29.8 / 0.0 ms  (average mu = 0.997, current mu = 0.978) allocation failure


<--- JS stacktrace --->
Cannot get stack trace in GC.
FATAL ERROR: NewSpace::Rebalance Allocation failed - JavaScript heap out of memory
 1: 00007FF6188E0EFA
 2: 00007FF6188BA296
 3: 00007FF6188BAC80

有什么方法可以禁用此内存堆栈吗?

0 个答案:

没有答案