Unverified Commit 8460373c authored by Jan Kaifer's avatar Jan Kaifer Committed by GitHub

Fix issue with instrumentation in a standalone build (#48615)

parent 39498d60
...@@ -2113,7 +2113,8 @@ export default async function build( ...@@ -2113,7 +2113,8 @@ export default async function build(
denormalizedAppPages, denormalizedAppPages,
outputFileTracingRoot, outputFileTracingRoot,
requiredServerFiles.config, requiredServerFiles.config,
middlewareManifest middlewareManifest,
hasInstrumentationHook
) )
}) })
} }
......
...@@ -1782,7 +1782,8 @@ export async function copyTracedFiles( ...@@ -1782,7 +1782,8 @@ export async function copyTracedFiles(
appPageKeys: readonly string[] | undefined, appPageKeys: readonly string[] | undefined,
tracingRoot: string, tracingRoot: string,
serverConfig: { [key: string]: any }, serverConfig: { [key: string]: any },
middlewareManifest: MiddlewareManifest middlewareManifest: MiddlewareManifest,
hasInstrumentationHook: boolean
) { ) {
const outputPath = path.join(distDir, 'standalone') const outputPath = path.join(distDir, 'standalone')
let moduleType = false let moduleType = false
...@@ -1888,6 +1889,7 @@ export async function copyTracedFiles( ...@@ -1888,6 +1889,7 @@ export async function copyTracedFiles(
Log.warn(`Failed to copy traced files for ${pageFile}`, err) Log.warn(`Failed to copy traced files for ${pageFile}`, err)
}) })
} }
if (appPageKeys) { if (appPageKeys) {
for (const page of appPageKeys) { for (const page of appPageKeys) {
if (middlewareManifest.functions.hasOwnProperty(page)) { if (middlewareManifest.functions.hasOwnProperty(page)) {
...@@ -1900,6 +1902,13 @@ export async function copyTracedFiles( ...@@ -1900,6 +1902,13 @@ export async function copyTracedFiles(
}) })
} }
} }
if (hasInstrumentationHook) {
await handleTraceFiles(
path.join(distDir, 'server', 'instrumentation.js.nft.json')
)
}
await handleTraceFiles(path.join(distDir, 'next-server.js.nft.json')) await handleTraceFiles(path.join(distDir, 'next-server.js.nft.json'))
const serverOutputPath = path.join( const serverOutputPath = path.join(
outputPath, outputPath,
......
{
"compilerOptions": {
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": false,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"incremental": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"plugins": [
{
"name": "next"
}
],
"strictNullChecks": true
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
"exclude": ["node_modules"]
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment