Skip to content

Commit

Permalink
Do not append sourceMappingURL to map files (#26851)
Browse files Browse the repository at this point in the history
* Do not append `sourceMappingURL` to map files

* apply recs
  • Loading branch information
erwinmombay committed Feb 18, 2020
1 parent c0454f7 commit 28cc6c6
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion build-system/compile/compile.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const gap = require('gulp-append-prepend');
const gulp = require('gulp');
const gulpIf = require('gulp-if');
const nop = require('gulp-nop');
const pathModule = require('path');
const rename = require('gulp-rename');
const sourcemaps = require('gulp-sourcemaps');
const {
Expand Down Expand Up @@ -117,6 +118,13 @@ function compile(
options,
timeInfo
) {
function shouldAppendSourcemappingURLText(file) {
// Do not append sourceMappingURL if its a sourcemap
return (
pathModule.extname(file.path) !== '.map' && options.esmPassCompilation
);
}

const hideWarningsFor = [
'third_party/amp-toolbox-cache-url/',
'third_party/caja/',
Expand Down Expand Up @@ -401,7 +409,7 @@ function compile(
.pipe(sourcemaps.write('.'))
.pipe(
gulpIf(
!!argv.esm,
shouldAppendSourcemappingURLText,
gap.appendText(`\n//# sourceMappingURL=${outputFilename}.map`)
)
)
Expand Down

0 comments on commit 28cc6c6

Please sign in to comment.