diff --git a/packages/next/src/build/index.ts b/packages/next/src/build/index.ts index 7b38541d7ca9c..5e6c245026d04 100644 --- a/packages/next/src/build/index.ts +++ b/packages/next/src/build/index.ts @@ -896,6 +896,9 @@ export default async function build( ) ) + const outputFileTracingRoot = + config.experimental.outputFileTracingRoot || dir + const manifestPath = path.join(distDir, SERVER_DIRECTORY, PAGES_MANIFEST) const requiredServerFiles = nextBuildSpan @@ -923,6 +926,7 @@ export default async function build( }, }, appDir: dir, + relativeAppDir: path.relative(outputFileTracingRoot, dir), files: [ ROUTES_MANIFEST, path.relative(distDir, manifestPath), @@ -1926,8 +1930,8 @@ export default async function build( const root = config.experimental?.turbotrace?.contextDirectory ?? - config.experimental?.outputFileTracingRoot ?? - dir + outputFileTracingRoot + const nextServerEntry = require.resolve( 'next/dist/server/next-server' ) @@ -2172,9 +2176,6 @@ export default async function build( ) ) - const outputFileTracingRoot = - config.experimental.outputFileTracingRoot || dir - if (config.output === 'standalone') { await nextBuildSpan .traceChild('copy-traced-files') diff --git a/test/production/standalone-mode/required-server-files/required-server-files.test.ts b/test/production/standalone-mode/required-server-files/required-server-files.test.ts index 2168708023d6d..4c91078c04b5c 100644 --- a/test/production/standalone-mode/required-server-files/required-server-files.test.ts +++ b/test/production/standalone-mode/required-server-files/required-server-files.test.ts @@ -321,6 +321,8 @@ describe('should set-up next', () => { expect(typeof requiredFilesManifest.config.configFile).toBe('undefined') expect(typeof requiredFilesManifest.config.trailingSlash).toBe('boolean') expect(typeof requiredFilesManifest.appDir).toBe('string') + // not in a monorepo so relative app dir is empty string + expect(requiredFilesManifest.relativeAppDir).toBe('') }) it('should de-dupe HTML/data requests', async () => {