简体   繁体   中英

cannot connect Peerjs in angular

tsconfig.json:::

{ "compileOnSave": false,

"compilerOptions": {

"baseUrl": "./",

"outDir": "./dist/out-tsc",

"forceConsistentCasingInFileNames": true,
"strict": true,
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"noImplicitOverride": true,
"noPropertyAccessFromIndexSignature": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"sourceMap": true,
"declaration": false,
"downlevelIteration": true,
"experimentalDecorators": true,
"moduleResolution": "node",
"importHelpers": true,
"target": "es2017",
"module": "es2020",
"lib": [
  "es2020",
  "dom"
]

},

"angularCompilerOptions": {

"enableI18nLegacyMessageIdFormat": false,
"strictInjectionParameters": true,
"strictInputAccessModifiers": true,
"strictTemplates": true

} }


angular service file :::

import Peer from 'peerjs'; . . .

this.actPeer = new Peer({debug:3}) ("peerjs__WEBPACK_IMPORTED_MODULE_0___default(...).Peer is not a constructor")


import { Peer } has same warn..

a year ago same code not has a problem like this..

I solved the problem. It's in package.json . Using a new regular install of PeerJS solves problem. I simply must add to global var ParcelRequire to pass anew appeared problem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM