GithubHelp home page GithubHelp logo

Comments (15)

BySlin avatar BySlin commented on May 20, 2024

把electron-updater放在dependencies中

from umi-plugin-electron-builder.

hemengke1997 avatar hemengke1997 commented on May 20, 2024

把electron-updater放在dependencies中

image

您看,确实是在dependecies里。
我刚才检查了打包出来的文件,package.json中只有 electron-devtools-installer

from umi-plugin-electron-builder.

BySlin avatar BySlin commented on May 20, 2024

image
把electron-updater配置到这里来

from umi-plugin-electron-builder.

BySlin avatar BySlin commented on May 20, 2024

将一些不能打包的包配置在electronBuilder下的externals中,只需要写包名,打包后即可使用

from umi-plugin-electron-builder.

hemengke1997 avatar hemengke1997 commented on May 20, 2024

将一些不能打包的包配置在electronBuilder下的externals中,只需要写包名,打包后即可使用

已解决,感谢作者。还想请问一个问题:
我按照 #24 中您的回答,把prefix改为了我司域名,依然无法进行http请求。请问在electron开发中,renderer的请求应该放在主进程中吗? 还是说按照网页开发,把页面请求放在页面中?

from umi-plugin-electron-builder.

BySlin avatar BySlin commented on May 20, 2024

将webSecurity设置为false 即可跨域,页面就可以直接请求了
通过contextIsolation设置为true,不开启nodeIntegration ,和contextBridge.exposeInMainWorld调用node环境下的方法,保证安全

from umi-plugin-electron-builder.

hemengke1997 avatar hemengke1997 commented on May 20, 2024

将webSecurity设置为false 即可跨域,页面就可以直接请求了
通过contextIsolation设置为true,不开启nodeIntegration ,和contextBridge.exposeInMainWorld调用node环境下的方法,保证安全

感谢作者指点。我刚上手electron,目前做法是开启了nodeIntegration,关闭了contextIsolation,个人感觉主进程与渲染进程通过contextBridge通信有点麻烦,对于以后的代码维护也不太好。请问您有比较好的实践项目吗?想学习一下

from umi-plugin-electron-builder.

hemengke1997 avatar hemengke1997 commented on May 20, 2024

将webSecurity设置为false 即可跨域,页面就可以直接请求了
通过contextIsolation设置为true,不开启nodeIntegration ,和contextBridge.exposeInMainWorld调用node环境下的方法,保证安全

页面的http请求应该放在主进程中还是渲染进程中呢?如果放在渲染进程中,按您所说的,可能不安全。如果放在主进程中,每次请求都需要与主进程通信,主进程会因为去做这些请求而卡顿吗

from umi-plugin-electron-builder.

BySlin avatar BySlin commented on May 20, 2024

页面的请求放在渲染进程中即可,对node的调用建议使用contextBridge,不建议使用nodeIntegration,开了nodeIntegration才不安全,网页中能执行node代码,就权限太高了,可能会被乱用,应该通过contextBridge限定网页能调用的方法,只要你不从网络加载代码,一般不会有问题
image

from umi-plugin-electron-builder.

hemengke1997 avatar hemengke1997 commented on May 20, 2024

@BySlin 请问作者,public文件夹中的文件,打包之后没有了,这种情况该如何处理呢?

from umi-plugin-electron-builder.

BySlin avatar BySlin commented on May 20, 2024

image
打包后存在啊
如果要public的文件不打包进app.asar,得按electron-builder的方式配置

from umi-plugin-electron-builder.

hemengke1997 avatar hemengke1997 commented on May 20, 2024

image
打包后存在啊
如果要public的文件不打包进app.asar,得按electron-builder的方式配置

这是打包命令
image
这是打包后的文件目录
image

😓 请问您有什么想法或者思路吗 我顺着您的思路去检查代码

from umi-plugin-electron-builder.

hemengke1997 avatar hemengke1997 commented on May 20, 2024

image
打包后存在啊
如果要public的文件不打包进app.asar,得按electron-builder的方式配置

我用您的demo代码尝试了一下,加了public文件夹,打包结果也没有那些静态文件

from umi-plugin-electron-builder.

BySlin avatar BySlin commented on May 20, 2024

用双目录结构public得放在src/renderer/下 @hemengke1997

from umi-plugin-electron-builder.

hemengke1997 avatar hemengke1997 commented on May 20, 2024

用双目录结构public得放在src/renderer/下 @hemengke1997

谢谢作者,已经解决了。请问这样做的原理是什么呢? 我一直以为public目录位置应该跟APP_ROOT同级,完全没想到要放在APP_ROOT(即rederer)下面

from umi-plugin-electron-builder.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.