Add sourcemap support to server build
Summary: Provide the same build parameters as for the main build and move the two bundles to a folder where we can pick them up. For consistency, I'm keeping the naming scheme with the main build. Reviewed By: antonk52 Differential Revision: D36521046 fbshipit-source-id: 9ea992d6e5dc299d88083d751ca8e84eadb1430b
This commit is contained in:
committed by
Facebook GitHub Bot
parent
3dbd3f43e1
commit
02adfa79e9
@@ -351,9 +351,35 @@ export async function moveSourceMaps(
|
||||
} else {
|
||||
// If we don't move them out of the build folders, they'll get included in the ASAR
|
||||
// which we don't want.
|
||||
console.log(`⏭ Removing source maps.`);
|
||||
await fs.remove(mainBundleMap);
|
||||
await fs.remove(rendererBundleMap);
|
||||
}
|
||||
}
|
||||
|
||||
export async function moveServerSourceMaps(
|
||||
buildFolder: string,
|
||||
sourceMapFolder: string | undefined,
|
||||
) {
|
||||
console.log(`⚙️ Moving server source maps...`);
|
||||
const mainBundleMap = path.join(buildFolder, 'dist', 'index.map');
|
||||
const rendererBundleMap = path.join(buildFolder, 'static', 'bundle.map');
|
||||
if (sourceMapFolder) {
|
||||
await fs.ensureDir(sourceMapFolder);
|
||||
await fs.move(mainBundleMap, path.join(sourceMapFolder, 'bundle.map'), {
|
||||
overwrite: true,
|
||||
});
|
||||
await fs.move(
|
||||
rendererBundleMap,
|
||||
path.join(sourceMapFolder, 'main.bundle.map'),
|
||||
{overwrite: true},
|
||||
);
|
||||
console.log(`✅ Moved to ${sourceMapFolder}.`);
|
||||
} else {
|
||||
// Removing so we don't bundle them up as part of the release.
|
||||
console.log(`⏭ Removing source maps.`);
|
||||
await fs.remove(mainBundleMap);
|
||||
await fs.remove(rendererBundleMap);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user