mirror of https://github.com/status-im/metro.git
Dont build sourcemap if it will not be used
Summary: Don't bother to work on the source map if it won't be used anyways Reviewed By: mjesun Differential Revision: D6884247 fbshipit-source-id: 811409313e7ac1a7255ddd0eed665ed92020241e
This commit is contained in:
parent
b1372a37bd
commit
63e8aebf79
|
@ -61,21 +61,27 @@ function saveAsIndexedFile(
|
|||
buildTableAndContents(startupCode, lazyModules, moduleGroups, encoding),
|
||||
).then(() => log('Done writing unbundle output'));
|
||||
|
||||
const sourceMap = relativizeSourceMap(
|
||||
buildSourceMapWithMetaData({
|
||||
startupModules: startupModules.concat(),
|
||||
lazyModules: lazyModules.concat(),
|
||||
moduleGroups,
|
||||
fixWrapperOffset: true,
|
||||
}),
|
||||
sourcemapSourcesRoot,
|
||||
);
|
||||
if (sourcemapOutput) {
|
||||
const sourceMap = relativizeSourceMap(
|
||||
buildSourceMapWithMetaData({
|
||||
startupModules: startupModules.concat(),
|
||||
lazyModules: lazyModules.concat(),
|
||||
moduleGroups,
|
||||
fixWrapperOffset: true,
|
||||
}),
|
||||
sourcemapSourcesRoot,
|
||||
);
|
||||
|
||||
return Promise.all([
|
||||
writeUnbundle,
|
||||
sourcemapOutput &&
|
||||
writeSourceMap(sourcemapOutput, JSON.stringify(sourceMap), log),
|
||||
]);
|
||||
const wroteSourceMap = writeSourceMap(
|
||||
sourcemapOutput,
|
||||
JSON.stringify(sourceMap),
|
||||
log,
|
||||
);
|
||||
|
||||
return Promise.all([writeUnbundle, wroteSourceMap]);
|
||||
} else {
|
||||
return writeUnbundle;
|
||||
}
|
||||
}
|
||||
|
||||
/* global Buffer: true */
|
||||
|
|
Loading…
Reference in New Issue