Hunter Ji

Results 46 comments of Hunter Ji

> 大佬打包白屏是什么原因啊,是electron16有问题吗 你看看electron的配置在打包时候是否加载的是否为vite buile之后的本地文件?打包时候顺序是vite build然后electron读取其编译好的文件再打包,重点在于如下配置: ![image](https://user-images.githubusercontent.com/25321169/144695255-af748cf5-aaec-4697-b18e-53699d7780d0.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) 既然配置没有问题的话,只能排查一下了,可以从两个方面入手: * 手动vite build,然后开发环境下读取dist下编译的文件(而不去读热加载的url),看看是否白屏以及有无报错 * 使用https://www.npmjs.com/package/electron-log,这个库,将可能的报错点输出成日志文件,在打包后查看日志 还有麻烦看一下环境变量,在打包时是否不是`development`。

> 非常期待博主的《减少electron打包后应用的体积》 多谢,第一次收到这种反馈,开心😄

> ![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的来 手动修改之后正常显示的话应该没什么问题,目前猜测可能是你的某些操作原本在web上正常使用,但是在electron中需要通过其api来实现导致的错误。还有,electron的F12调试显示那个警告并不影响的。

> 而且也不是某些操作,就是刚建的vite hellow项目,什么代码其他模块都没有,也是白屏 只是新建的项目的话,文章上附了源码,你可以对比看一下。如果你觉得需要,可以把你遇到问题的仓库链接发下,我看一下呢。

> 你好方便的话可以看一下 https://github.com/seepine/vite-vue3-electron-starter router这里改成hash模式 ```javascript const router = createRouter({ history: createWebHashHistory(), routes }) ```

> > > 你好方便的话可以看一下 https://github.com/seepine/vite-vue3-electron-starter > > > > > > router这里改成hash模式 > > ```js > > const router = createRouter({ > > history: createWebHashHistory(), > > routes > >...

> 你好,请教一下,执行 yarn electron:build 之后,vue正常打包,但是electron-builder报错,我找了很久不知道什么原因,麻烦你能不能看一下,谢谢~(代码我是直接 clone 的 ![image](https://user-images.githubusercontent.com/20775437/154667173-1c95cd54-bcfc-41b1-be20-5f6293963619.png) 你好,这里有个报错,就关于电脑底层的,你可以修复一下看看呢。 ![截屏2022-02-19 上午9 07 06](https://user-images.githubusercontent.com/25321169/154779787-6703de48-5ade-45aa-b5da-f980ba42e2f2.png)

> > > 你好,请教一下,执行 yarn electron:build 之后,vue正常打包,但是electron-builder报错,我找了很久不知道什么原因,麻烦你能不能看一下,谢谢~(代码我是直接 clone 的 ![image](https://user-images.githubusercontent.com/20775437/154667173-1c95cd54-bcfc-41b1-be20-5f6293963619.png) > > > > > > 你好,这里有个报错,就关于电脑底层的,你可以修复一下看看呢。 ![截屏2022-02-19 上午9 07 06](https://user-images.githubusercontent.com/25321169/154779787-6703de48-5ade-45aa-b5da-f980ba42e2f2.png) > > 确实是电脑的问题,解决了,谢谢! 😊😊😊

> ![image](https://user-images.githubusercontent.com/54132758/160605368-d8fc9945-bba0-4175-b67f-93eaf85c4a6d.png) 按照你的教程、开发环境可以成功运行、但是我打包后无法加载js、css,可能是什么原因呢 你首先确认下报错提示的文件路径是否正确。这个截图信息比较少,其它的方向我暂时没有什么头绪。😣