Allow importing package without webpack

This commit is contained in:
Andras Schmelczer 2026-09-19 22:19:37 +01:00
commit 260d32795a
3 changed files with 11 additions and 8 deletions

View file

@ -1,15 +1,13 @@
import { v4 as uuidv4 } from "uuid";
import { packageVersion } from "./package-version";
export function createClientId(): string {
// @ts-expect-error, injected by webpack
const packageVersion = __CURRENT_VERSION__; // eslint-disable-line
const platform =
typeof navigator !== "undefined"
? navigator.platform // eslint-disable-line @typescript-eslint/no-deprecated
: typeof process !== "undefined"
? process.platform
: "unknown";
? process.platform
: "unknown";
return `vault-link/${packageVersion} (${uuidv4()}; ${platform})`;
}

View file

@ -0,0 +1,7 @@
declare const __CURRENT_VERSION__: string;
/** Webpack replaces this identifier in bundles; source imports use a stable fallback. */
export const packageVersion =
typeof __CURRENT_VERSION__ === "undefined"
? "development"
: __CURRENT_VERSION__;

View file

@ -1,7 +1,5 @@
import * as Sentry from "@sentry/browser";
// @ts-expect-error, injected by webpack
const packageVersion = __CURRENT_VERSION__; // eslint-disable-line
import { packageVersion } from "./package-version";
export const setUpTelemetry = (): (() => void) => {
Sentry.init({