Skip to content

Commit 199ae04

Browse files
committed
fix preview
1 parent ae9f977 commit 199ae04

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

apps/web/src/lib/constants.ts

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,19 @@
11
import dynamic from 'next/dynamic';
22

3-
export const baseURL = process.env.NEXT_PUBLIC_VERCEL_URL
4-
? `https://${process.env.NEXT_PUBLIC_VERCEL_URL}`
5-
: 'http://localhost:3000';
3+
export const baseURL = (() => {
4+
// Production URL
5+
if (process.env.NEXT_PUBLIC_VERCEL_URL) {
6+
return `https://${process.env.NEXT_PUBLIC_VERCEL_URL}`;
7+
}
8+
9+
// Preview deployments
10+
if (process.env.VERCEL_ENV === 'preview') {
11+
return `https://${process.env.VERCEL_URL}`;
12+
}
13+
14+
// Local development
15+
return 'http://localhost:3000';
16+
})();
617

718
export type ToolState = 'available' | 'installed' | 'configured';
819

0 commit comments

Comments
 (0)