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.

Unable to import Peer in Angular application

See original GitHub issue

Issue #479 is still present. I am using version 0.3.20 of peerjs. To reproduce:

  • create new Angular app ng new app
  • npm install --save peerjs
  • edit app.component.ts file:
import * as Peer from 'peerjs';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent implements OnInit {
  title = 'app';

  ngOnInit(): void {
    new Peer('123', {})

  }
}
  • npm start Result will be: ERROR TypeError: peerjs__WEBPACK_IMPORTED_MODULE_2__ is not a constructor

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:13 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
kidandcatcommented, Feb 13, 2019

I’m working on it, anyway any PR is welcome

2reactions
nhducseuitcommented, May 28, 2019

@kidandcat I was able to resolve my issue by enabling following flag in tsconfig.json file

{
...
    "esModuleInterop": true,
...
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

npm WARN ... requires a peer of ... but none is installed ...
npm WARN @angular/animations@4.3.6 requires a peer of @angular/core@4.3.6 but none is installed. You must install peer dependencies yourself.
Read more >
fortawesome/angular-fontawesome
To get up and running using Font Awesome with Angular follow below steps: Add FontAwesomeModule to imports in src/app/app.module.ts :.
Read more >
tslib direct dependency migration
If you have any libraries within your workspace, this migration will convert tslib peer dependencies to direct dependencies for the libraries.
Read more >
you must install peer dependencies yourself Code Example
npm WARN codelyzer@6.0.1 requires a peer of tslint@^5.0.0 || ^6.0.0 but none is installed. You must install peer dependencies yourself. typescript by devops ......
Read more >
npm err eresolve could not resolve angular
Use "npm install --legacy-peer-deps" because your Application route version is old and you installed new version of Angular CLI dependencies ,so it make ......
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