Dont build sourcemap stuff if it wont be used

Summary: Don't bother to work on the source map if it won't be used anyways

Reviewed By: rafeca

Differential Revision: D6884244

fbshipit-source-id: ac014bf982e33c669a1e79f16dd06149e758a797
This commit is contained in:
Peter van der Zee 2018-02-05 00:59:33 -08:00 committed by Facebook Github Bot
parent 5e505980ec
commit eb08ed4adc
1 changed files with 19 additions and 14 deletions

View File

@ -66,21 +66,26 @@ function saveAsAssets(
); );
writeUnbundle.then(() => log('Done writing unbundle output')); writeUnbundle.then(() => log('Done writing unbundle output'));
const sourceMap = buildSourceMapWithMetaData({ if (sourcemapOutput) {
fixWrapperOffset: true, const sourceMap = buildSourceMapWithMetaData({
lazyModules: lazyModules.concat(), fixWrapperOffset: true,
moduleGroups: null, lazyModules: lazyModules.concat(),
startupModules: startupModules.concat(), moduleGroups: null,
}); startupModules: startupModules.concat(),
if (sourcemapSourcesRoot !== undefined) { });
relativizeSourceMapInline(sourceMap, sourcemapSourcesRoot); if (sourcemapSourcesRoot !== undefined) {
} relativizeSourceMapInline(sourceMap, sourcemapSourcesRoot);
}
const wroteSourceMap = writeSourceMap(
sourcemapOutput,
JSON.stringify(sourceMap),
log,
);
return Promise.all([ return Promise.all([writeUnbundle, wroteSourceMap]);
writeUnbundle, } else {
sourcemapOutput && return writeUnbundle;
writeSourceMap(sourcemapOutput, JSON.stringify(sourceMap), log), }
]);
} }
function createDir(dirName) { function createDir(dirName) {