Skip to content

Commit 4a4a3f8

Browse files
rsbhclaude
andcommitted
fix: output build artifacts to project cwd instead of package dir
Nitro's vercel preset resolves output from rootDir which defaults to Vite's root (packageRoot). Override output.dir and publicDir via nitro config to resolve from projectRoot (cwd). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent c4d433b commit 4a4a3f8

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

packages/chronicle/src/server/vite-config.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ import remarkDirective from 'remark-directive';
88
import { type InlineConfig } from 'vite';
99
import remarkUnusedDirectives from '../lib/remark-unused-directives';
1010

11+
function resolveOutputDir(projectRoot: string, preset?: string): string {
12+
if (preset === 'vercel' || preset === 'vercel-static') return path.resolve(projectRoot, '.vercel/output');
13+
return path.resolve(projectRoot, '.output');
14+
}
15+
1116
export interface ViteConfigOptions {
1217
packageRoot: string;
1318
projectRoot: string;
@@ -96,6 +101,11 @@ export async function createViteConfig(
96101
}
97102
}
98103
}
99-
}
104+
},
105+
nitro: {
106+
output: {
107+
dir: resolveOutputDir(projectRoot, preset),
108+
},
109+
},
100110
};
101111
}

0 commit comments

Comments
 (0)