reconnecting-websocket icon indicating copy to clipboard operation
reconnecting-websocket copied to clipboard

ReconnectingWebSocket is not defined, Electron app

Open ghost opened this issue 7 years ago • 3 comments

Hi, I get an error while running an app in Electron. This app is running normally in browsers (firefox, chrome, chromium v63.0.3239.132), but not in Electron (chromium v58.0.3029.110)

Electron loads the url of the app in a browser window like a user would do and I get this error at launch:

ReconnectingWebSocket is not defined

Whatever I do (including the lib just before the implementation in the same file) I get this error.

ghost avatar Jan 29 '18 16:01 ghost

Try import ReconnectingWebSocket from 'reconnecting-websocket'

jeeftor avatar Apr 02 '18 08:04 jeeftor

不行啊 我的也不行提示这个没有定义 我的跟他的是一样的 我们就是把普通的网页嵌入electron 正常网页是好的 但是嵌入后就不行了出错了 你上面说的方法是解决纯nodejs编写的应用的 我们的方式是用electron简单加载了我们的网页而已 所以你说的方法解决部了啊

yq5858588 avatar Apr 19 '18 02:04 yq5858588

Try this solution

<script>if (typeof module === 'object') {window.ReconnectingWebSocket = window.ReconnectingWebSocket = module.exports;};</script>

UEhQZXI avatar Mar 20 '19 09:03 UEhQZXI