Skip to content

Commit d3738c2

Browse files
authored
add buildDir in options prop (#113)
1 parent 041b3c2 commit d3738c2

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

packages/nextjs-cache-handler/src/instrumentation/register-initial-cache.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,12 @@ export type RegisterInitialCacheOptions = {
4747
* @default true
4848
*/
4949
routes?: boolean;
50+
/**
51+
* Override the default build directory.
52+
*
53+
* @default .next
54+
*/
55+
buildDir?: string;
5056
};
5157

5258
/**
@@ -89,7 +95,7 @@ export async function registerInitialCache(
8995
options: RegisterInitialCacheOptions = {},
9096
) {
9197
const debug = typeof process.env.NEXT_PRIVATE_DEBUG_CACHE !== "undefined";
92-
const nextJsPath = path.join(process.cwd(), ".next");
98+
const nextJsPath = path.join(process.cwd(), options.buildDir ?? ".next");
9399
const prerenderManifestPath = path.join(nextJsPath, PRERENDER_MANIFEST);
94100
const serverDistDir = path.join(nextJsPath, SERVER_DIRECTORY);
95101
const fetchCacheDir = path.join(nextJsPath, "cache", "fetch-cache");

0 commit comments

Comments
 (0)