New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to import Peer 1.0.1 in Angular 8 app #552
Comments
Changing module to "CommonJs" helps remove compilation error but do not fix the runtime error: still #3 case. the
can be linked with this issue: parcel-bundler/parcel#1401 |
The right way is
This shouldn't affect the library nor the compile process. |
Yep, it is working approach thanks. |
sorry! it was patch in index.html which I added and forgot to remove:
without this patch I got :
in runtime. so you can check the error there: https://github.com/furozen/PeerJs-example |
I think it's not a BUG, It works in my angular 8 project. |
So I've added peerjs (v1.1.0) to an Angular app. Initially, I had no issues or errors. Peerjs wasn't really utilized until you navigated through 2-3 steps and it just worked. I added another part to the app, which fired up peerjs upon landing and that's when I started seeing the parcelRequire error. I added the parcelRequire initialization from #552 (comment) and it seems to just work now. I'm guessing there's a race condition somewhere, but I haven't spent the time to dig into it further. |
Same problem on Angular 9. I added both |
this works for me as a temp fix in index.html as per @furozen post.
|
This remains an issue in 2021 when importing peerjs into a lit-element project.
rather than, you know, declaring the variable
As a result, things just break in my lit-element project, while the browser happily hoists this variable to the global scope and moves on with things. |
In case anyone is still having trouble - here's how we've implemented a solution.
Make sure you import the |
it works thanks for your help |
<script> var parcelRequire; </script> this is a sad state of affairs but this seems to work |
Could anyone test it in |
# [1.4.0](v1.3.2...v1.4.0) (2022-05-10) ### Bug Fixes * add changelog and npm version to the repo ([d5bd955](d5bd955)) * add token to PeerJSOption type definition ([e7675e1](e7675e1)) * websocket connection string ([82b8c71](82b8c71)) ### Features * upgrade to Parcel@2 ([aae9d1f](aae9d1f)), closes [#845](#845) [#859](#859) [#552](#552) [#585](#585) ### Performance Improvements * **turn:** lower TURN-latency due to more local servers ([a412ea4](a412ea4))
"peerjs": "^2.0.0-beta.3" then , [!] Error: 'Peer' is not exported by ....\node_modules\peerjs\dist\peerjs.js, imported by src\peerjs.ts |
@nlokhande1 Import syntax for the beta version: import { Peer } from 'peerjs'; This issue can be closed. Importing from Angular does not require a workaround starting from v1.4. |
Hello!
I tried to use peerJs with angular 8 but failed.
I did not able to import it to an app.
I've created a tiny project ( https://github.com/furozen/PeerJs-example )for show this issue:
#1
compile error:
#2
compile error:
#3
compile error:
runtime:
#4
compile error:
runtime:
The text was updated successfully, but these errors were encountered: