Results 80 comments of seepine

大佬打包白屏是什么原因啊,是electron16有问题吗

![image](https://user-images.githubusercontent.com/93666053/144381544-02982f43-fb7a-4f42-995a-d5105cde3d96.png) 是需要配置这个吗?

主要配置就这几个,都是没错的 ![image](https://user-images.githubusercontent.com/93666053/144698262-1ab0d488-5324-4d1d-bb6c-4d9c7c88b51d.png) ![image](https://user-images.githubusercontent.com/93666053/144698267-e113ecd6-a574-4b51-a8b7-e87f8d71eff6.png) ![image](https://user-images.githubusercontent.com/93666053/144698273-877dbf0e-7d92-4767-ae67-747cf4c5ec0b.png) ![image](https://user-images.githubusercontent.com/93666053/144698279-3ba9417b-52bc-4484-bb2d-c97618b31386.png)

![image](https://user-images.githubusercontent.com/93666053/144798013-f15fd07e-0c9a-4f6d-ad8c-d711fcc5a076.png) 我直接这样,本地运行 ![image](https://user-images.githubusercontent.com/93666053/144799703-640f8262-e19f-4521-b3e8-332adafc4145.png) ![image](https://user-images.githubusercontent.com/93666053/144799727-a2381344-1229-458f-9256-ddea4f0f240c.png) ![image](https://user-images.githubusercontent.com/93666053/144799735-02a9c3c8-9931-4375-b8e7-c49c2fbcc83a.png) 里面有一段`because the document's frame is sandboxed and the 'allow-scripts' permission is not set.`,是需要开启script?但是我看electron,javascript默认是true的来

貌似就是这个无法加载script的问题,我手动改html改为纯文本,就可以显示出来

> 打包后白屏, 按博主大佬的思路,开发环境下读取dist下编译的文件. 执行yarn electron:serve后, 报错:NODE_ENV is not defined > > 将NODE_ENV 修改为: process.env.NODE_ENV > > yarn electron:serve 正常运行 yarn electron:build 打包后, 正常运行 > > 以前都是用webpack , 一直想体验一下vite+electron, 这下舒服了. 感谢博主提供这个系列的文章....

q > 我的依赖版本: > > "dependencies": { "vue": "^3.2.23" }, "devDependencies": { "@vitejs/plugin-vue": "^1.10.2", "concurrently": "^6.4.0", "cross-env": "^7.0.3", "electron": "^16.0.4", "electron-builder": "^22.14.5", "vite": "^2.7.0", "wait-on": "^6.0.0" }, 奇了怪了版本一样,我macOs和window10都试了都是白屏,你是ts还是js啊,难道是ts有问题? ```json {...

配置地址即可 ``` npm config set ELECTRON_MIRROR "https://npmmirror.com/mirrors/electron/" npm config set ELECTRON_BUILDER_BINARIES_MIRROR "https://mirrors.huaweicloud.com/electron-builder-binaries/" ```

> 手动修改之后正常显示的话应该没什么问题,目前猜测可能是你的某些操作原本在web上正常使用,但是在electron中需要通过其api来实现导致的错误。还有,electron的F12调试显示那个警告并不影响的。 是手动改为加载本地html文件也不行

而且也不是某些操作,就是刚建的vite hellow项目,什么代码其他模块都没有,也是白屏