()
| 1 | import { BuildConfig, getBuildConfig } from "./build"; |
| 2 | |
| 3 | export function getClientConfig() { |
| 4 | if (typeof document !== "undefined") { |
| 5 | // client side |
| 6 | return JSON.parse(queryMeta("config") || "{}") as BuildConfig; |
| 7 | } |
| 8 | |
| 9 | if (typeof process !== "undefined") { |
| 10 | // server side |
| 11 | return getBuildConfig(); |
| 12 | } |
| 13 | } |
| 14 | |
| 15 | function queryMeta(key: string, defaultValue?: string): string { |
| 16 | let ret: string; |