Skip to content

Commit e52a6ba

Browse files
committed
fix(sandbox): keep preview cache project-relative
1 parent bc8864a commit e52a6ba

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

apps/agent-worker/src/durable-objects/agent-run-app-builder.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -587,6 +587,7 @@ async function startAppBuilderDevServer(
587587
cwd: workspace.dir,
588588
env: {
589589
CHEATCODE_APP_RUNTIME: "next",
590+
CHEATCODE_NEXT_DIST_DIR: "../cache/next",
590591
CHOKIDAR_USEPOLLING: "true",
591592
WATCHPACK_POLLING: "1000",
592593
},

apps/agent-worker/src/durable-objects/project-sandbox-package-runtime.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,13 @@ export function projectPackageEnvironment(
5454
if (!workspaceSlug) return requested;
5555
const modulesDir = projectLocalModulesDir(workspaceSlug);
5656
const requestedNodePath = requested?.["NODE_PATH"];
57+
const requestedNextDistDir = requested?.["CHEATCODE_NEXT_DIST_DIR"];
5758
const preferredRuntime = requested?.["CHEATCODE_APP_RUNTIME"] === "expo" ? "expo" : "next";
5859
const fallbackRuntime = preferredRuntime === "expo" ? "next" : "expo";
5960
return {
6061
...requested,
61-
CHEATCODE_NEXT_DIST_DIR: `${projectLocalCacheDir(workspaceSlug)}/next`,
62+
CHEATCODE_NEXT_DIST_DIR:
63+
requestedNextDistDir ?? `../../home/node/.cheatcode/projects/${workspaceSlug}/cache/next`,
6264
NODE_PATH: [
6365
modulesDir,
6466
`${APP_RUNTIME_ROOT}/${preferredRuntime}/node_modules`,

0 commit comments

Comments
 (0)