question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support using repo like an npm dependency (e.g. have tasks compile to dist/peer.js)

See original GitHub issue

Until 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:closed
  • Created 5 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
xavierfuentescommented, Feb 3, 2019

@kidandcat Apologies for reopening a closed issue, but I still can’t use PeerJS as a module… To reproduce:

  • create a new react app yarn create react-app my-app
  • add peerjs dependency yarn add peerjs
  • edit src/App.js and add:
import Peer from "peerjs";
// ...
class App extends Component {
  componentDidMount() {
    const peer = new Peer('peer-id', {});
  }
  // ...
}
  • run the app yarn start

if you browse to http://localhost:3000 you will get: TypeError: peerjs__WEBPACK_IMPORTED_MODULE_9___default.a is not a constructor

1reaction
adadgiocommented, Oct 21, 2019

This issue is still unresovled, sorry.

Read more comments on GitHub >

github_iconTop Results From Across the Web

package.json - npm Docs
This document is all you need to know about what's required in your package.json file. It must be actual JSON, not just a...
Read more >
How To Use Node.js Modules with npm and package.json
The init command will then ask for the project's git repository, which may live on a service such as GitHub (for more information,...
Read more >
How to specify local modules as npm package dependencies
For this to work mymodule must be configured as a module with its own ... As of npm 2.0, local dependencies are supported...
Read more >
npm packages in the Package Registry - GitLab Docs
Watch a video demo of how to publish npm packages to the GitLab Package Registry. Publish to GitLab Package Registry. Authentication to the...
Read more >
Use Azure Pipelines to build and publish a Node.js package
js package with Node Package Manager (npm) and publish a pipeline artifact. Prerequisites. You must have the following items in Azure DevOps: A ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found