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.

Failed to construct Peer Object - peerjs__WEBPACK_IMPORTED_MODULE_2__ error

See original GitHub issue

I am trying to create a peer by below code:

import * as Peer from ‘peerjs’; this.myPeerId = aaa${Math.floor((Math.random() * 10) + 1)}; this.peer = new Peer(this.myPeerId, {key: ‘lwjd5qra8257b9’});

However, I received this error: peerjs__WEBPACK_IMPORTED_MODULE_2__ is not a constructor

Anyone can help? Thanks!

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
nhducseuitcommented, May 24, 2019

I am trying to create a peer by below code:

import * as Peer from ‘peerjs’; this.myPeerId = aaa${Math.floor((Math.random() * 10) + 1)}; this.peer = new Peer(this.myPeerId, {key: ‘lwjd5qra8257b9’});

However, I received this error: peerjs__WEBPACK_IMPORTED_MODULE_2__ is not a constructor

Anyone can help? Thanks!

Exactly what I’m facing now with Angular 7.

@frankrobert import Peer from 'peerjs'; doesn’t work. The error says that the module has no default export.

0reactions
FelixSeltercommented, Jan 2, 2022
import { peerjs } from 'peerjs';
const Peer = peerjs.Peer;

TypeError: peerjs__WEBPACK_IMPORTED_MODULE_1__ is not a constructor Please help me with this error

The above is actually working

Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

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