Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: import multiaddr and daemon client modules dynamically #2565

Merged
merged 1 commit into from
May 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions packages/transport-webtransport/.aegir.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { createClient } from '@libp2p/daemon-client'
import { multiaddr } from '@multiformats/multiaddr'
import { execa } from 'execa'
import { path as p2pd } from 'go-libp2p'
import pDefer from 'p-defer'
Expand Down Expand Up @@ -27,6 +25,10 @@ export default {
}

async function createGoLibp2p () {
// dynamic import is necessary because these modules have dependencies on
// modules in this monorepo which may not have been built yet
const { multiaddr } = await import('@multiformats/multiaddr')
const { createClient } = await import('@libp2p/daemon-client')
const controlPort = Math.floor(Math.random() * (50000 - 10000 + 1)) + 10000
const apiAddr = multiaddr(`/ip4/127.0.0.1/tcp/${controlPort}`)
const deferred = pDefer()
Expand Down
Loading