Unable to import Peer in Angular application
See original GitHub issueIssue #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:
- Created 5 years ago
- Reactions:3
- Comments:13 (5 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I’m working on it, anyway any PR is welcome
@kidandcat I was able to resolve my issue by enabling following flag in tsconfig.json file