K
K
kvakazyambra2015-05-07 17:06:20
JavaScript
kvakazyambra, 2015-05-07 17:06:20

How to generate a source map for files included with require?

We have a gulp task:

gulp.task('js', function() {
    gulp.src('*.js')
        .pipe(sourcemaps.init())
        .pipe(browserify())
        .pipe(sourcemaps.write('./maps/', {includeContent: false}))
        .pipe(gulp.dest('./'));
});

And a js file with something like this:
require('foo.js');
require('bar.js');

//some local code

Source map in this case is created for a concatenated common js file, which includes code from foo.js, bar.js and the file in which they are included. And the lines in the generated source map point to line numbers in that file.
It is necessary that the mapping be on specific final files foo.js and bar.js How can this be done? Perhaps using some other plugins.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
smanioso, 2015-05-07
@smanioso

https://github.com/gulpjs/gulp/blob/master/docs/re...
or any other example that suits your case...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question