mirror of
https://github.com/webstudio-is/webstudio.git
synced 2026-11-21 12:12:54 +09:00
Ref https://remix.run/docs/en/1.15.0/guides/constraints#server-code-pruning Remix use NAME.server.ts extension to enforce omitting module from client bundles. Though we heavily used `/server` in packages which had no affect and blocked us in using a few node apis which were not polifilled with empty modules while bundling for client. Here I replaced `/server` with `/index.server` and removed all legacy server entry points which are not longer necessary with new typescript resolution.
17 lines
528 B
TypeScript
17 lines
528 B
TypeScript
import { createTrpcProxyServiceClient } from "@webstudio-is/trpc-interface/index.server";
|
|
import env from "~/env/env.server";
|
|
|
|
const TRPC_SERVER_URL = env.TRPC_SERVER_URL ?? "";
|
|
const TRPC_SERVER_API_TOKEN = env.TRPC_SERVER_API_TOKEN ?? "";
|
|
const BRANCH_NAME = env.BRANCH_NAME;
|
|
|
|
export const trpcClient = createTrpcProxyServiceClient(
|
|
TRPC_SERVER_URL !== "" && TRPC_SERVER_API_TOKEN !== ""
|
|
? {
|
|
url: TRPC_SERVER_URL,
|
|
token: TRPC_SERVER_API_TOKEN,
|
|
branchName: BRANCH_NAME,
|
|
}
|
|
: undefined
|
|
);
|