Skip to content

Commit ad7626b

Browse files
committed
use env.BASE_URL instead of env.SERVER_BASE_URL
1 parent 7550f7c commit ad7626b

8 files changed

Lines changed: 10 additions & 17 deletions

File tree

apps/fixtures/experiments/src/routes/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export default function Home() {
2323
console.log(await v.hello);
2424
});
2525
const port = isServer ? new URL(getRequestEvent()!.request.url).port: location.port;
26-
fetch(`http://localhost:${port}/${import.meta.env.SERVER_BASE_URL}/unknown`, {
26+
fetch(`http://localhost:${port}${import.meta.env.BASE_URL}/unknown`, {
2727
headers: { Accept: "application/json" }
2828
}).then(async res => console.log(await res.json()));
2929
return (

apps/fixtures/experiments/tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"strict": true,
1212
"noEmit": true,
1313
"isolatedModules": true,
14+
"types": ["vite/client"],
1415
"paths": {
1516
"~/*": ["./src/*"]
1617
}

packages/start/src/server/handler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export function createBaseHandler(
3434
const url = new URL(event.request.url);
3535
const pathname = url.pathname;
3636

37-
const serverFunctionTest = join("/", SERVER_FN_BASE);
37+
const serverFunctionTest = join(import.meta.env.BASE_URL, SERVER_FN_BASE);
3838
if (pathname.startsWith(serverFunctionTest)) {
3939
const serverFnResponse = await handleServerFunction(e);
4040

packages/start/src/server/manifest/dev-client-manifest.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,7 @@ export function getClientDevManifest() {
66
return import(/* @vite-ignore */ join("/", id))
77
},
88
async getAssets(id) {
9-
const assetsPath =
10-
join(
11-
import.meta.env.BASE_URL,
12-
`@manifest/client/${Date.now()}/assets?id=${id}`,
13-
);
9+
const assetsPath = `/@manifest/client/${Date.now()}/assets?id=${id}`;
1410

1511
const assets = (await import(/* @vite-ignore */ assetsPath)).default;
1612

packages/start/src/server/manifest/dev-ssr-manifest.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,9 @@ import { join, normalize } from "pathe";
22

33
export function getSsrDevManifest(environment: "client" | "ssr") {
44
return {
5-
path: (id: string) => normalize(join("/", id)),
5+
path: (id: string) => normalize(join(import.meta.env.BASE_URL, id)),
66
async getAssets(id) {
7-
const assetsPath =
8-
join(
9-
import.meta.env.BASE_URL,
10-
`@manifest/${environment}/${Date.now()}/assets?id=${id}`,
11-
);
7+
const assetsPath = `/@manifest/${environment}/${Date.now()}/assets?id=${id}`;
128

139
const assets = (await import(/* @vite-ignore */ assetsPath)).default;
1410

packages/start/src/server/server-fns-runtime.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { provideRequestEvent } from "solid-js/web/storage";
44
export function createServerReference(fn: Function, id: string) {
55
if (typeof fn !== "function")
66
throw new Error("Export from a 'use server' module must be a function");
7-
const baseURL = import.meta.env.SERVER_BASE_URL ?? "";
7+
const baseURL = import.meta.env.BASE_URL ?? "";
88
return new Proxy(fn, {
99
get(target, prop, receiver) {
1010
if (prop === "url") {

packages/start/src/server/server-functions-handler.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ function handleNoJS(
237237
`Location`,
238238
new URL(
239239
result.headers.get("Location")!,
240-
url.origin + import.meta.env.SERVER_BASE_URL,
240+
url.origin + import.meta.env.BASE_URL,
241241
).toString(),
242242
);
243243
statusCode = getExpectedRedirectStatus(result);
@@ -318,7 +318,7 @@ async function handleSingleFlight(
318318
url = new URL(
319319
result.headers.get("Location")!,
320320
new URL(sourceEvent.request.url).origin +
321-
import.meta.env.SERVER_BASE_URL,
321+
import.meta.env.BASE_URL,
322322
).toString();
323323
}
324324
const event = { ...sourceEvent } as PageEvent;

packages/start/src/server/server-runtime.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ async function fetchServerFunction(
193193
}
194194

195195
export function createServerReference(id: string) {
196-
const baseURL = import.meta.env.SERVER_BASE_URL ?? "";
196+
const baseURL = import.meta.env.BASE_URL ?? "";
197197
const fn = (...args: any[]) => fetchServerFunction(`${baseURL}/_server`, id, {}, args);
198198

199199
return new Proxy(fn, {

0 commit comments

Comments
 (0)