Closed stupid-boar closed 2 years ago
@stupid-boar since @libp2p/webrtc-star
is esm only library, you should change module
in your tsconfig.json
and put "type": "module"
in your package.json
file.
Another option could be to use some nightly build of typescript (haven't tried myself): https://www.typescriptlang.org/docs/handbook/esm-node.html
Thx!) It's work
version
"@libp2p/webrtc-star": "^1.0.6"
code example
Error
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main defined in node_modules/@libp2p/webrtc-star/package.json at new NodeError (node:internal/errors:371:5) at throwExportsNotFound (node:internal/modules/esm/resolve:453:9) at packageExportsResolve (node:internal/modules/esm/resolve:671:7) at resolveExports (node:internal/modules/cjs/loader:482:36) at Function.Module._findPath (node:internal/modules/cjs/loader:522:31) at Function.Module._resolveFilename (node:internal/modules/cjs/loader:919:27) at Function.Module._load (node:internal/modules/cjs/loader:778:27) at Module.require (node:internal/modules/cjs/loader:1005:19) at require (node:internal/modules/cjs/helpers:102:18) at Object. (build/p2p.js:12:23) {
code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'
}
build&run