create-surf-app 1.0.0-alpha.10 → 1.0.0-alpha.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -15,6 +15,21 @@ function useSurfAppReady() {
|
|
|
15
15
|
}, [])
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
+
// Patch fetch so `/api/*` calls automatically include basePath.
|
|
19
|
+
// Without this, `fetch('/api/...')` hits the parent app's routes instead of
|
|
20
|
+
// the preview dev server's API routes.
|
|
21
|
+
// DO NOT REMOVE — this is required for the preview proxy architecture.
|
|
22
|
+
const _basePath = process.env.NEXT_PUBLIC_BASE_PATH || ""
|
|
23
|
+
if (typeof window !== "undefined" && _basePath) {
|
|
24
|
+
const _origFetch = window.fetch
|
|
25
|
+
window.fetch = function patchedFetch(input, init) {
|
|
26
|
+
if (typeof input === "string" && input.startsWith("/api/")) {
|
|
27
|
+
input = _basePath + input
|
|
28
|
+
}
|
|
29
|
+
return _origFetch.call(this, input, init)
|
|
30
|
+
} as typeof window.fetch
|
|
31
|
+
}
|
|
32
|
+
|
|
18
33
|
export function Providers({ children }: { children: React.ReactNode }) {
|
|
19
34
|
useSurfAppReady()
|
|
20
35
|
|
|
@@ -3,7 +3,13 @@ import type { NextConfig } from 'next'
|
|
|
3
3
|
const nextConfig: NextConfig = {
|
|
4
4
|
output: 'standalone',
|
|
5
5
|
basePath: process.env.BASE_PATH!.replace(/\/+$/, ''),
|
|
6
|
+
env: {
|
|
7
|
+
NEXT_PUBLIC_BASE_PATH: process.env.BASE_PATH!.replace(/\/+$/, ''),
|
|
8
|
+
},
|
|
6
9
|
serverExternalPackages: ['@surf-ai/sdk', 'drizzle-orm', 'drizzle-kit', 'croner'],
|
|
10
|
+
logging: {
|
|
11
|
+
browserToTerminal: true,
|
|
12
|
+
},
|
|
7
13
|
}
|
|
8
14
|
|
|
9
15
|
export default nextConfig
|