Dont relativate source map if it wont be used

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

Reviewed By: mjesun

Differential Revision: D6884243

fbshipit-source-id: 483664ad32a72a8e6e3de3e0cc224b3a6ea67d46
This commit is contained in:
Peter van der Zee 2018-02-05 00:59:26 -08:00 committed by Facebook Github Bot
parent 92e9cfa050
commit b1372a37bd
1 changed files with 7 additions and 7 deletions

View File

@ -53,13 +53,6 @@ function saveBundleAndMap(
sourcemapSourcesRoot,
} = options;
let {map} = bundle;
if (sourcemapSourcesRoot !== undefined) {
log('start');
map = createCodeWithMap(map, sourcemapSourcesRoot);
log('finish');
}
log('Writing bundle output to:', bundleOutput);
const {code} = bundle;
@ -74,6 +67,13 @@ function saveBundleAndMap(
);
if (sourcemapOutput) {
let {map} = bundle;
if (sourcemapSourcesRoot !== undefined) {
log('start relativating source map');
map = createCodeWithMap(map, sourcemapSourcesRoot);
log('finished relativating');
}
log('Writing sourcemap output to:', sourcemapOutput);
const writeMap = writeFile(sourcemapOutput, map, null);
writeMap.then(() => log('Done writing sourcemap output'));