From b188c114cf2908f9d8a9564442fab50f04da9e4a Mon Sep 17 00:00:00 2001 From: Katie Byers Date: Wed, 27 Jul 2022 19:18:46 -0700 Subject: [PATCH] add default `distDir` value back into `index.server.ts` --- packages/nextjs/src/index.server.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/nextjs/src/index.server.ts b/packages/nextjs/src/index.server.ts index d060c02e61bb..e5d43a44fd8c 100644 --- a/packages/nextjs/src/index.server.ts +++ b/packages/nextjs/src/index.server.ts @@ -93,8 +93,9 @@ function sdkAlreadyInitialized(): boolean { } function addServerIntegrations(options: NextjsOptions): void { - // This value is injected at build time, based on the output directory specified in the build config - const distDirName = (global as GlobalWithDistDir).__rewriteFramesDistDir__; + // This value is injected at build time, based on the output directory specified in the build config. Though a default + // is set there, we set it here as well, just in case something has gone wrong with the injection. + const distDirName = (global as GlobalWithDistDir).__rewriteFramesDistDir__ || '.next'; // nextjs always puts the build directory at the project root level, which is also where you run `next start` from, so // we can read in the project directory from the currently running process const distDirAbsPath = path.resolve(process.cwd(), distDirName);