UNPKG

profile-pics

Version:

19 lines 635 B
import { Capacitor } from '@capacitor/core'; /** * Fixes the image path for Android devices during development. * Replaces 'localhost' with the appropriate site root URL. * @param croppedImage * @returns */ export function replaceLocalhostWithSiteRoot(croppedImage) { let imageSrc = croppedImage; if (imageSrc && process.env.NODE_ENV !== 'production' && Capacitor.getPlatform() === 'android') { if (imageSrc.includes('localhost')) { imageSrc = imageSrc.replace(/http\:\/\/localhost\:\d+/, process.env.SITE_ROOT); } } return imageSrc; } //# sourceMappingURL=helper.js.map