mirror of
https://github.com/enricoros/big-AGI.git
synced 2026-05-10 21:50:14 -07:00
Client stubs: Env
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* Client-side stub for env.server.ts - used by webpack to replace env.server.ts in client bundles
|
||||
*/
|
||||
|
||||
// [server-side] throw immediately if imported
|
||||
if (typeof window === 'undefined')
|
||||
throw new Error('[DEV] env.client-mock: client module should never be imported on the server.');
|
||||
|
||||
// [client-side] stub exports matching env.server.ts interface
|
||||
export const env = new Proxy({} as any, {
|
||||
|
||||
get(_target, prop) {
|
||||
throw new Error(`[DEV] env.client-mock: client shall not access server env.${String(prop)}`);
|
||||
},
|
||||
|
||||
});
|
||||
@@ -1,4 +1,12 @@
|
||||
// noinspection ES6PreferShortImport - because the build would not find this file with ~/...
|
||||
/**
|
||||
* Server-side environment variables centralized access and validation.
|
||||
* Replaced with env.client-mock.ts on client builds via webpack.
|
||||
*/
|
||||
// [server-side] throw immediately if imported on client side
|
||||
if (typeof window !== 'undefined')
|
||||
throw new Error('[DEV] env.server: server module should never be imported on the client.');
|
||||
|
||||
// noinspection ES6PreferShortImport - because this is included by `next.config.ts` and build would not find this file with ~/...
|
||||
import { createEnv } from '../modules/3rdparty/t3-env';
|
||||
import * as z from 'zod/v4';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user