Allow importing package without webpack
This commit is contained in:
parent
2d3ecc8f98
commit
260d32795a
3 changed files with 11 additions and 8 deletions
|
|
@ -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})`;
|
||||
}
|
||||
|
|
|
|||
7
frontend/sync-client/src/utils/package-version.ts
Normal file
7
frontend/sync-client/src/utils/package-version.ts
Normal 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__;
|
||||
|
|
@ -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({
|
||||
|
|
|
|||
Loading…
Reference in a new issue