mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-14 12:11:47 +08:00
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:
committed by
Facebook Github Bot
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 = {|
|
||||
|
||||
Reference in New Issue
Block a user