Closed fitouch closed 1 month ago
https://stackoverflow.com/questions/74830166/unable-to-import-esm-module-in-nestjs
At first glance this looks to be an issue with NestJS not supporting ESM-only modules. (libp2p only exports esm, not cjs)
@tabcat Thank you for the clarification! That clears things up. I’ll go ahead and close this issue.
Version:
Platform:
Subsystem:
Severity:
High - The main functionality of the application does not work, API breakage, repo format breakage, etc.
Description:
I am integrating
libp2p
into a NestJS project, and I encountered the following error when trying to import and uselibp2p
:Steps to reproduce the error:
nest new test-project
libp2p
and other related dependencies:npm install libp2p @libp2p/webrtc @libp2p/websockets @chainsafe/libp2p-noise @chainsafe/libp2p-yamux @libp2p/circuit-relay-v2
libp2p
to a service file:@Injectable() export class MyService { async onModuleInit() { const node = await createLibp2p({ // libp2p node configuration }); } }