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,9 +1,7 @@
import { v4 as uuidv4 } from "uuid"; import { v4 as uuidv4 } from "uuid";
import { packageVersion } from "./package-version";
export function createClientId(): string { export function createClientId(): string {
// @ts-expect-error, injected by webpack
const packageVersion = __CURRENT_VERSION__; // eslint-disable-line
const platform = const platform =
typeof navigator !== "undefined" typeof navigator !== "undefined"
? navigator.platform // eslint-disable-line @typescript-eslint/no-deprecated ? navigator.platform // eslint-disable-line @typescript-eslint/no-deprecated

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