Your sourceRoot gets the value /src/ because you said it here:
gulp.src('./public/src/**/*.js', {base: './public/src'})
You set {base: './public/src'} so that everyone on the line handles paths relative to src , so this is the correct sourceRoot . But at the top of the display, it should have paths relative to the elements in "sources":[...] (for example, "sources":["comp1/c1-a.min.js.map"] ).
However, if you really wanted to change sourceRoot, you can do this using the sourceRoot parameter for gulp -sourcemaps , but then your sources would be wrong. However, gulp -sourcemaps version 2.0.0-alpha (which you must explicitly request in package.json , as this is a preliminary release) also has a mapSources parameter mapSources that you can also change them.
Similarly, you can use sourceMappingURLPrefix or sourceMappingURL to change sourceMappingURL. In the latter case, you get the full file object so you can check for example. cwd , base , etc. console.debug or Visual Studio code can be of great help when debugging npm / gulp tasks! This article shows how to set breakpoints, view variables, etc., which I found very useful.
source share