fix: replace static whatsapp-rust-bridge imports with lazy dynamic loading
The whatsapp-rust-bridge package contains a top-level await on an inline WASM binary, which propagates through the ESM graph and causes ERR_REQUIRE_ASYNC_MODULE when CJS consumers try to require() this package. Replace all static imports from whatsapp-rust-bridge with a lazy-loading bridge module (wasm-bridge.ts) that uses import().then() instead of top-level await, keeping the dependency out of the static ESM graph. https://claude.ai/code/session_01XaA7GwNaB6azTHFYQ8WEpB
This commit is contained in:
+1
-1
@@ -118,7 +118,7 @@ export function sha256(buffer: Buffer) {
|
||||
return createHash('sha256').update(buffer).digest()
|
||||
}
|
||||
|
||||
export { hkdf, md5 } from 'whatsapp-rust-bridge'
|
||||
export { hkdf, md5 } from './wasm-bridge'
|
||||
|
||||
export async function derivePairingCodeKey(pairingCode: string, salt: Buffer): Promise<Buffer> {
|
||||
// Convert inputs to formats Web Crypto API can work with
|
||||
|
||||
Reference in New Issue
Block a user