diff --git a/packager/src/ModuleGraph/output/as-plain-bundle.js b/packager/src/ModuleGraph/output/as-plain-bundle.js index c05d67d36..601cf5562 100644 --- a/packager/src/ModuleGraph/output/as-plain-bundle.js +++ b/packager/src/ModuleGraph/output/as-plain-bundle.js @@ -16,7 +16,7 @@ const {addModuleIdsToModuleWrapper} = require('./util'); import type {OutputFn} from '../types.flow'; module.exports = ( - (modules, filename, idForPath) => { + (modules, filename, idForPath, sourceMapPath) => { let code = ''; let line = 0; const sections = []; @@ -37,6 +37,10 @@ module.exports = ( line += countLines(moduleCode); } + if (sourceMapPath) { + code += `/*# sourceMappingURL=${sourceMapPath}*/`; + } + return {code, map: createIndexMap({file: filename, sections})}; }: OutputFn); diff --git a/packager/src/ModuleGraph/types.flow.js b/packager/src/ModuleGraph/types.flow.js index 8809cfbda..a7a3cb782 100644 --- a/packager/src/ModuleGraph/types.flow.js +++ b/packager/src/ModuleGraph/types.flow.js @@ -72,8 +72,9 @@ export type Module = {| export type OutputFn = ( modules: Iterable, - filename?: string, + filename: string, idForPath: IdForPathFn, + sourceMapPath?: string, ) => OutputResult; type OutputResult = {|