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

add events.setMaxListeners polyfill #60

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

zaach
Copy link

@zaach zaach commented May 16, 2023

This is the minimal addition needed to build js-libp2p with vite. It fixes this error:

relay:build: > vite build
relay:build:
relay:build: vite v4.3.5 building for production...
relay:build: transforming...
relay:build: Use of eval in "../../node_modules/.pnpm/@[email protected]/node_modules/@
protobufjs/inquire/index.js" is strongly discouraged as it poses security risks and may cause
issues with minification.
relay:build: ✓ 604 modules transformed.
relay:build: ✓ built in 3.43s
relay:build: "setMaxListeners" is not exported by "../../node_modules/.pnpm/rollup-plugin-node
[email protected]/node_modules/rollup-plugin-node-polyfills/polyfills/events.js", imported by "
../../node_modules/.pnpm/[email protected]/node_modules/libp2p/dist/src/connection-manager/utils.j
s".
relay:build: file: /Users/zach/repos/decentralized/ipdm/node_modules/.pnpm/[email protected]/node_
modules/libp2p/dist/src/connection-manager/utils.js:4:9
relay:build: 2: import { logger } from '@libp2p/logger';
relay:build: 3: import { anySignal } from 'any-signal';
relay:build: 4: import { setMaxListeners } from 'events';
relay:build:             ^
relay:build: 5: const log = logger('libp2p:connection-manager:utils');
relay:build: 6: /**
relay:build: error during build:
relay:build: RollupError: "setMaxListeners" is not exported by "../../node_modules/.pnpm/rollu
[email protected]/node_modules/rollup-plugin-node-polyfills/polyfills/events.js",
imported by "../../node_modules/.pnpm/[email protected]/node_modules/libp2p/dist/src/connection-ma
nager/utils.js".
...

I've published this fix to npm as @zaach/rollup-plugin-node-polyfills for now to get this demo working: https://github.com/zaach/js-libp2p-webrtc-private-to-private

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant