From d28868508b26e71364b0457a4d09120ce005b9eb Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Thu, 15 Dec 2022 06:23:28 -0500 Subject: [PATCH] Revert "*Need to use dynamic import" This reverts commit 6413d97c61dd0fc680615aa3ec3c1e16269d9865. --- src/modules/plugins/rpc.ts | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/src/modules/plugins/rpc.ts b/src/modules/plugins/rpc.ts index f1931ef..400a3cb 100644 --- a/src/modules/plugins/rpc.ts +++ b/src/modules/plugins/rpc.ts @@ -11,30 +11,13 @@ import { import { getRpcByPeer } from "../rpc"; import { get as getSwarm, LUMEWEB_TOPIC_HASH } from "../swarm"; import b4a from "b4a"; - -import type { ClearablePromise } from "p-timeout"; - -async function dImport(pkg: string): Promise { - return new Function(`return import("${pkg}")`); -} - -let pTimeout: typeof import("p-timeout").default; -const pTimeoutImport = dImport( - "p-timeout" -) as unknown as typeof import("p-timeout"); - -async function importSetup() { - if (!pTimeout) { - pTimeout = (await pTimeoutImport).default; - } -} +import pTimeout, { ClearablePromise } from "p-timeout"; async function broadcastRequest( request: RPCRequest, relays: string[], timeout = 5000 ): Promise>> { - await importSetup(); const makeRequest = async (relay: string) => { const rpc = await getRpcByPeer(relay); return rpc.request(`${request.module}.${request.method}`, request.data);