Gets the application version for the Electron main process.
Uses dynamic import to safely access the Electron app module only in main process context.
Fallback: renderer version or npm package version if main process unavailable.
Source
exportconstgetAppVersionElectron = async (): Promise<string> => { try { // Only import app in Electron main process if (globalThis.window === undefined) { constelectron = awaitimport("electron"); returnelectron.app.getVersion(); } // Fallback for renderer process returngetAppVersion(); } catch { return ( process.env.VITE_APP_VERSION ?? process.env.npm_package_version ?? "1.0.0" ); } };
getAppVersionElectron():Promise<string>
Returns Promise<string>
A promise resolving to the current application version as a string.
Gets the application version for the Electron main process. Uses dynamic import to safely access the Electron app module only in main process context. Fallback: renderer version or npm package version if main process unavailable.
Source