Skip to content

Commit 0139d12

Browse files
authored
fix(game-bridge): resolve ethers bundling issue for game engine builds (#2668)
1 parent 219490c commit 0139d12

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

packages/game-bridge/src/index.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,18 @@ import {
99
trackDuration,
1010
identify,
1111
} from '@imtbl/metrics';
12-
import { BrowserProvider } from 'ethers';
12+
// eslint-disable-next-line import/no-duplicates
13+
import * as ethers from 'ethers';
14+
// eslint-disable-next-line import/no-duplicates
15+
import { BrowserProvider, getAddress } from 'ethers';
16+
17+
// This patches a bundler issue where @0xsequence/core expects
18+
// `ethers.getAddress` to exist on the `ethers` namespace, but Parcel
19+
// fails to attach it in a global build. This ensures the function is
20+
// available before any Passport code executes.
21+
if (typeof ethers === 'object' && !ethers.getAddress) {
22+
(ethers as any).getAddress = getAddress;
23+
}
1324

1425
/* eslint-disable no-undef */
1526
const scope = 'openid offline_access profile email transact';

0 commit comments

Comments
 (0)