Support using repo like an npm dependency (e.g. have tasks compile to dist/peer.js)
See original GitHub issueUntil the move to Typescript, the peerjs repo could have been used just like any other NPM depenency. Simply add dependency as “peerjs”: “git+https://github.com/peers/peerjs.git” and it would get compiled into /node_modules/peerjs/dist/peer.js.
Thus a node application that is using the dependency could have easily imported it into an application and use peer.
However, with move to TS, we have a non-required postinstall tasks that break the usage in such scenario with an error (just try to clone use the current repo as a dependency via git and you’ll know what I mean). Furthermore, even in we fork the current peerjs repo and remove postinstall, it still doesn’t have an install or build tasks that would result in the creation of “dist/peer.js” file.
So my suggestion is to add those build tasks. A Question - now with current repo configuration, how do I build the peerjs library into dist/peer.js? Thanks.
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (3 by maintainers)

Top Related StackOverflow Question
@kidandcat Apologies for reopening a closed issue, but I still can’t use PeerJS as a module… To reproduce:
yarn create react-app my-appyarn add peerjssrc/App.jsand add:yarn startif you browse to http://localhost:3000 you will get:
TypeError: peerjs__WEBPACK_IMPORTED_MODULE_9___default.a is not a constructorThis issue is still unresovled, sorry.