diff --git a/packages/keychain/src/components/home.tsx b/packages/keychain/src/components/home.tsx index c9296892e..dda95356b 100644 --- a/packages/keychain/src/components/home.tsx +++ b/packages/keychain/src/components/home.tsx @@ -26,12 +26,12 @@ export function Home() { typeof window !== "undefined" && !window.location.hostname.includes("localhost") ) { - posthog.init(process.env.VITE_POSTHOG_KEY!, { - api_host: process.env.VITE_POSTHOG_HOST, + posthog.init(import.meta.env.VITE_POSTHOG_KEY!, { + api_host: import.meta.env.VITE_POSTHOG_HOST, person_profiles: "always", enable_recording_console_log: true, loaded: (posthog) => { - if (process.env.NODE_ENV === "development") posthog.debug(); + if (import.meta.env.DEV) posthog.debug(); }, }); } diff --git a/packages/keychain/src/hooks/analytics.ts b/packages/keychain/src/hooks/analytics.ts index 27e47a6af..ed853f747 100644 --- a/packages/keychain/src/hooks/analytics.ts +++ b/packages/keychain/src/hooks/analytics.ts @@ -31,7 +31,7 @@ export const useAnalytics = () => { }; const log = async (type: string, payload: object) => { - if (process.env.NODE_ENV === "development") { + if (import.meta.env.DEV) { return console.log(type, payload); } diff --git a/packages/keychain/src/utils/controller.ts b/packages/keychain/src/utils/controller.ts index 6ceff1083..2d8a65f12 100644 --- a/packages/keychain/src/utils/controller.ts +++ b/packages/keychain/src/utils/controller.ts @@ -61,7 +61,7 @@ export default class Controller extends Account { username, { webauthn: { - rpId: process.env.VITE_RP_ID!, + rpId: import.meta.env.VITE_RP_ID!, credentialId, publicKey, }, diff --git a/packages/keychain/vite.config.ts b/packages/keychain/vite.config.ts index 41bc19233..588d43b05 100644 --- a/packages/keychain/vite.config.ts +++ b/packages/keychain/vite.config.ts @@ -1,13 +1,12 @@ import { defineConfig } from "vite"; import react from "@vitejs/plugin-react-swc"; -import process from "node:process"; import wasm from "vite-plugin-wasm"; import topLevelAwait from "vite-plugin-top-level-await"; -export default defineConfig({ +export default defineConfig(({ mode }) => ({ plugins: [wasm(), topLevelAwait(), react()], server: { - port: process.env.NODE_ENV === "development" ? 3001 : undefined, + port: mode === "development" ? 3001 : undefined, }, resolve: { alias: { @@ -16,4 +15,4 @@ export default defineConfig({ }, root: "./", publicDir: "public", -}); +}));