diff --git a/packages/gatsby/src/commands/build.ts b/packages/gatsby/src/commands/build.ts index a909f1e3d33f0..a222cee30c453 100644 --- a/packages/gatsby/src/commands/build.ts +++ b/packages/gatsby/src/commands/build.ts @@ -57,6 +57,7 @@ interface IBuildArgs extends IProgram { profile: boolean graphqlTracing: boolean openTracingConfigFile: string + keepPageRenderer: boolean } module.exports = async function build(program: IBuildArgs): Promise { @@ -284,10 +285,12 @@ module.exports = async function build(program: IBuildArgs): Promise { } buildHTMLActivityProgress.end() - try { - await deleteRenderer(pageRenderer) - } catch (err) { - // pass through + if (!program.keepPageRenderer) { + try { + await deleteRenderer(pageRenderer) + } catch (err) { + // pass through + } } let deletedPageKeys: Array = []