Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(electron): detect electron context (#1856)
* fix(electron): detect electron env * fix(electron): cleanup code * fix: fixed wrong operator * fix(electron): improved code and add some comments * Update src/lib/is-browser.ts Co-authored-by: Daniel Lando <[email protected]> * fix: typo and lint --------- Co-authored-by: Daniel Lando <[email protected]>
- Loading branch information
6a03d29
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to break electron 12.2.3 even when adding the webPreferences changes:
![Screenshot 2024-05-16 at 9 46 32 AM](https://private-user-images.githubusercontent.com/159864719/331364796-6d4f5071-f757-4f29-acfb-78c489e58a1f.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkzNjA2MDgsIm5iZiI6MTczOTM2MDMwOCwicGF0aCI6Ii8xNTk4NjQ3MTkvMzMxMzY0Nzk2LTZkNGY1MDcxLWY3NTctNGYyOS1hY2ZiLTc4YzQ4OWU1OGExZi5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjEyJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxMlQxMTM4MjhaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0xYWY1YzJjNWM0MjViNzA2MGU3MDEzMTU1MmQ0ODYxOWQ1MDRiOWQ3MTY1YTcyMzczNDI5NWY2MDhkYjYwZDQxJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.Nw6qLqoFX9z2Q8SZkQVdCWq8hj3epmOlVpEHixAgIRw)
![Screenshot 2024-05-16 at 9 46 43 AM](https://private-user-images.githubusercontent.com/159864719/331364806-a91924d1-584c-47ad-8c28-772da062869e.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkzNjA2MDgsIm5iZiI6MTczOTM2MDMwOCwicGF0aCI6Ii8xNTk4NjQ3MTkvMzMxMzY0ODA2LWE5MTkyNGQxLTU4NGMtNDdhZC04YzI4LTc3MmRhMDYyODY5ZS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjEyJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxMlQxMTM4MjhaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT02MjYzODQzYWQ3NjBmODA0ZTlmYjM3YzJmZWZhZjQ1MjgzY2M3NTIxNTM2YjFmNWY2NTE2Y2ZmN2RkZTE5ZDlkJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.5k6Og4Uff2tBQ_VnFMlFrXVWFLU_PNfU6-IKBFruztQ)
![Screenshot 2024-05-16 at 9 53 53 AM](https://private-user-images.githubusercontent.com/159864719/331364813-3fb1b8f1-576a-4034-b0be-1666c6f65717.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkzNjA2MDgsIm5iZiI6MTczOTM2MDMwOCwicGF0aCI6Ii8xNTk4NjQ3MTkvMzMxMzY0ODEzLTNmYjFiOGYxLTU3NmEtNDAzNC1iMGJlLTE2NjZjNmY2NTcxNy5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjEyJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxMlQxMTM4MjhaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0yNDY0MWMzOTdjZTg1YjQwYmY2Mzc5MjIzMzU4NDcwZTY2NDBmM2Y1NGQ4YTYzZjlmYWM5YzY0N2ExMDVlYTlmJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.yYoJ_BEyWHmnCSOJqiCQu1Py49WQ5rVazjfocCJ__3A)
6a03d29
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@axi92 Want to sbumit a pr to fix the issue?
6a03d29
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Electron is currently on version 30.x.x
Version 12 reached EOL 2021 and was on node 14.
I can try but I don't think I can make a fix for all electron versions.
@cmoniz-ocean Are you maybe able to upgrade your electron version to a maintained version? You can check the timelines here https://www.electronjs.org/docs/latest/tutorial/electron-timelines
6a03d29
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@axi92 I was able to upgrade to electron 30, but I'll be validating hardware compatibility tomorrow
(I think a typeof somewhere here might fix the bug - #1868)
6a03d29
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@axi92 Apparently 5.6.0 throws this error with electron version 30.0.6 as well - I've added a PR #1868