Skip to content
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

peerjs.min.js compiled with a function $(...) #989

Closed
whoisterencelee opened this issue Aug 8, 2022 · 4 comments
Closed

peerjs.min.js compiled with a function $(...) #989

whoisterencelee opened this issue Aug 8, 2022 · 4 comments
Assignees
Labels
bug confirmed acknowledged as an issue released

Comments

@whoisterencelee
Copy link

whoisterencelee commented Aug 8, 2022

The dist/peerjs.min.js for some reason is compiled with a function $ which is global and gets into conflict with browser debugger's $ or any globally defined $

This causes this error whenever using $('someDOMselector') in site:

Uncaught TypeError: right-hand side of 'in' should be an object, got undefined``

Because it expect $(window) from this function, from webrtc-adapter dependency

export function shimGetDisplayMedia(window) {
  if (!('getDisplayMedia' in window.navigator)) {
@whoisterencelee
Copy link
Author

A workaround is the replace
function $(...
with
function shim(

and

return $
with
return shim

in dist/peerjs.min.js

@jonasgloning jonasgloning self-assigned this Aug 8, 2022
@create-issue-branch
Copy link

@jonasgloning jonasgloning added bug confirmed acknowledged as an issue labels Aug 8, 2022
@jonasgloning
Copy link
Member

Hey @whoisterencelee, thanks for the report!

The file is polluting the global namespace. This definitely shouldn’t happen.
A fix should be trivial: The output format of the bundler was set to the wrong environment.
But I want to ensure that the patch doesn’t break anything else, so there’s a bit more testing before release.

github-actions bot pushed a commit that referenced this issue Aug 9, 2022
## [1.4.7](v1.4.6...v1.4.7) (2022-08-09)

### Bug Fixes

* **browser-bundle:** Leaked private functions in the global scope ([857d425](857d425)), closes [#989](#989)
@github-actions
Copy link

github-actions bot commented Aug 9, 2022

🎉 This issue has been resolved in version 1.4.7 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug confirmed acknowledged as an issue released
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants