murat-dogan / node-datachannel

WebRTC For Node.js and Electron. libdatachannel node bindings.
Mozilla Public License 2.0
280 stars 52 forks source link

can't import cleanup from CommonJS #249

Closed nferch closed 1 month ago

nferch commented 2 months ago

Having trouble importing the cleanup function from CommonJS:


5 import { cleanup } from 'node-datachannel';
                          ~~~~~~~~~~~~~~~~~~

Importing from the polyfills seems to work fine.

murat-dogan commented 2 months ago

For CommonJS, you need to use require. This works for me;


const nodeDataChannel = require("node-datachannel");
....
nodeDataChannel.cleanup();