Append `sourceMappingURL` in bundle building function
Summary: We appended a `sourceMappingURL` in the same place where we write out the files. This will break output that is not a plain text file, like Random Access Bundles. This moves the corresponding logic into the function that builds the bundle. Reviewed By: cpojer Differential Revision: D5061039 fbshipit-source-id: 17fadb5a687c8d4b1f29439e8bf946bae58eb2d9
This commit is contained in:
parent
40a53918ec
commit
280ec6e1eb
|
@ -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);
|
||||
|
||||
|
|
|
@ -72,8 +72,9 @@ export type Module = {|
|
|||
|
||||
export type OutputFn = (
|
||||
modules: Iterable<Module>,
|
||||
filename?: string,
|
||||
filename: string,
|
||||
idForPath: IdForPathFn,
|
||||
sourceMapPath?: string,
|
||||
) => OutputResult;
|
||||
|
||||
type OutputResult = {|
|
||||
|
|
Loading…
Reference in New Issue