在Electron开发桌面应用中,之前的angularjs项目使用了websocket重连的方法,通过<script>引入进来,但是在Electron上运行的时候,会报错!后来找到一片说明的文档,是因为有冲突
解决办法:
<html> <script>if (typeof module === 'object') {window.module = module; module = undefined;}</script> //开头 ............................//这里写你要引入的jQuery/Vuejs/angularjs包等等.. ............................//你的代码 <script src=""></script> //自己的外部js代码 <script>if (window.module) module = window.module;</script> //结尾 </html>
主要就是开头结尾两句话,大神操作,具体解决的原因不是很了解,但确实不加就会报错,加了就好用了
原文档地址:https://blog.csdn.net/xxhdcblogzh888/article/details/78106347