mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-21 14:11:26 +00:00
fix(matrix): load crypto-nodejs via createRequire to fix __dirname in ESM
This commit is contained in:
committed by
Gustavo Madeira Santana
parent
2022dfd0a1
commit
6f98ee7f62
@@ -1,3 +1,9 @@
|
||||
import { Attachment, EncryptedAttachment } from "@matrix-org/matrix-sdk-crypto-nodejs";
|
||||
import { createRequire } from "node:module";
|
||||
|
||||
// Load via createRequire so the CJS package gets __dirname (its index.js
|
||||
// uses __dirname to locate platform-specific native .node bindings).
|
||||
const require = createRequire(import.meta.url);
|
||||
const { Attachment, EncryptedAttachment } =
|
||||
require("@matrix-org/matrix-sdk-crypto-nodejs") as typeof import("@matrix-org/matrix-sdk-crypto-nodejs");
|
||||
|
||||
export { Attachment, EncryptedAttachment };
|
||||
|
||||
Reference in New Issue
Block a user