javascript - Remove part of sourcemaps mapping -
i have 2 gulp tasks: first handles caching + babel + sourcemaps, other 1 concatenates translated files 1 single javascript file + sourcemaps.
gulp.task('prepare:js', () => { const babeloptions = { "presets": [ [ "env", { "targets": { "browsers": ["firefox >= 24"]} } ] ] } return gulp.src('app/scripts') .pipe(changed('.tmp/scripts')) .pipe(sourcemaps.init()) .pipe(babel(babeloptions)) .pipe(sourcemaps.write('.')) .pipe(gulp.dest('.tmp/scripts')) }) gulp.task('package:js', ['prepapre:js'], () => { return gulp.src(['.tmp/scripts/*.js', '.tmp/scripts/**/*.js']) .pipe(sourcemaps.init({loadmaps: true})) .pipe(concat('app.bundle.js')) .pipe(sourcemaps.write('.')) .pipe(gulp.dest('dist/scripts)) })
it works want. remaining issue sourcemaps. indeed, generates single sourcemap duplicate informations:
- one mapping between original code (located in
app/scripts
) , concatenated fileloadmaps: true
(that's 1 want keep) - another mapping between babelified code (located in
.tmp/scripts
) , concatenated code (that's 1 want rid of).
the thing is, if remove instruction .pipe(sourcemaps.init({loadmaps: true}))
, first sourcemaps no longer included. merge these 2 tasks not able use gulp-changed
anymore (since change file located in app/scripts
trigger concatenation , refresh cache).
how can rid of second mapping?
Comments
Post a Comment