gulp-sourcemaps: RangeError: Maximum call stack size exceeded

When trying to run browserify+uglify using gulp-sourcemaps, I get the following error:

node_modules/gulp-sourcemaps/node_modules/convert-source-map/index.js:109
  var m = content.match(commentRx);
                  ^
RangeError: Maximum call stack size exceeded

The gulp task looks a bit like this:

var browserify = require('browserify');
var source = require('vinyl-source-stream');
var buffer = require('vinyl-buffer');
var uglify = require('gulp-uglify');
var sourcemaps = require('gulp-sourcemaps');

gulp.task('bundle', function () {
    var bundle = browserify({
        debug: true,
    });
    bundle.bundle()
    .on('error', gutil.log.bind(gutil, 'Browserify Error'))
    .pipe(source(getBundleName('client')))
    .pipe(buffer())
    .pipe(sourcemaps.init({loadMaps: true}))
    .pipe(uglify())
    .pipe(sourcemaps.write('./'))
    .pipe(gulp.dest('./build'));
});

This happens with gulp-sourcemaps 1.2.8. Downgrading to 1.1.0 fixes it. With 1.2.8, this issue occurs even if the uglify line is commented out.

The same issue also occurs unless I specifically use gulp-uglify 0.3.1. Any later version also breaks it.

Possibly this is something to do with very large sourcemaps.

Any help would be much appreciated.

Thanks.

About this issue

  • Original URL
  • State: closed
  • Created 10 years ago
  • Comments: 26 (2 by maintainers)

Commits related to this issue

Most upvoted comments

gulp-sourcemaps 1.4.0 fixes my original issue and my example test case (https://github.com/AgentME/sm-test).