Skip to content

Commit

Permalink
fix: Use regular import to reference package.json (#2871)
Browse files Browse the repository at this point in the history
Use regular import to reference the package.json of the SDK. This makes
referencing the JSON work in the browser as well when using ESM.
  • Loading branch information
FrederikBolding authored Nov 1, 2024
1 parent 965b265 commit 3d7e2f2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/snaps-utils/coverage.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"branches": 99.74,
"functions": 98.93,
"lines": 99.46,
"statements": 96.36
"statements": 96.37
}
5 changes: 3 additions & 2 deletions packages/snaps-utils/src/platform-version.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import packageJson from '@metamask/snaps-sdk/package.json';

/**
* Get the current supported platform version.
*
Expand All @@ -8,6 +10,5 @@
* @returns The platform version.
*/
export function getPlatformVersion() {
// eslint-disable-next-line import/no-dynamic-require, @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires
return require('@metamask/snaps-sdk/package.json').version;
return packageJson.version;
}

0 comments on commit 3d7e2f2

Please sign in to comment.