Skip to content

Commit 7d937fa

Browse files
committed
fix instrumentation trace file
1 parent dd3a610 commit 7d937fa

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
//TODO: Move all other manifest path here as well
22
export const MIDDLEWARE_TRACE_FILE = "server/middleware.js.nft.json";
3+
export const INSTRUMENTATION_TRACE_FILE = "server/instrumentation.js.nft.json";

packages/open-next/src/build/copyTracedFiles.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@ import path from "node:path";
1616
import { loadConfig, loadPrerenderManifest } from "config/util.js";
1717
import { getCrossPlatformPathRegex } from "utils/regex.js";
1818
import logger from "../logger.js";
19-
import { MIDDLEWARE_TRACE_FILE } from "./constant.js";
19+
import {
20+
INSTRUMENTATION_TRACE_FILE,
21+
MIDDLEWARE_TRACE_FILE,
22+
} from "./constant.js";
2023

2124
const __dirname = url.fileURLToPath(new URL(".", import.meta.url));
2225

@@ -170,13 +173,25 @@ File ${fullFilePath} does not exist
170173
}
171174
};
172175

176+
// Check for instrumentation trace file
177+
if (existsSync(path.join(dotNextDir, INSTRUMENTATION_TRACE_FILE))) {
178+
// We still need to copy the nft.json file so that computeCopyFilesForPage doesn't throw
179+
copyFileSync(
180+
path.join(dotNextDir, INSTRUMENTATION_TRACE_FILE),
181+
path.join(standaloneNextDir, INSTRUMENTATION_TRACE_FILE),
182+
);
183+
computeCopyFilesForPage("instrumentation");
184+
logger.debug("Adding instrumentation trace files");
185+
}
186+
173187
if (existsSync(path.join(dotNextDir, MIDDLEWARE_TRACE_FILE))) {
174188
// We still need to copy the nft.json file so that computeCopyFilesForPage doesn't throw
175189
copyFileSync(
176190
path.join(dotNextDir, MIDDLEWARE_TRACE_FILE),
177191
path.join(standaloneNextDir, MIDDLEWARE_TRACE_FILE),
178192
);
179193
computeCopyFilesForPage("middleware");
194+
logger.debug("Adding node middleware trace files");
180195
}
181196

182197
const hasPageDir = routes.some((route) => route.startsWith("pages/"));

0 commit comments

Comments
 (0)