Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support electron-builder in mac #18

Open
wxfred opened this issue Apr 19, 2021 · 4 comments
Open

Support electron-builder in mac #18

wxfred opened this issue Apr 19, 2021 · 4 comments

Comments

@wxfred
Copy link

wxfred commented Apr 19, 2021

__dirname has different meaning in electron-builder, in font-list/libs/darwin/index.js
const bin = path.join(__dirname, 'fontlist')
can't get the correct path of the fontlist file.
Is there any solution?

@oldj
Copy link
Owner

oldj commented Apr 19, 2021

Do you have more information? My project is also packaged using electron-builder, and everything seems to go well.

@wxfred
Copy link
Author

wxfred commented Jul 1, 2021

@oldj 我使用的是vue-cli-plugin-electron-builder,mac下electron调试,代码会被临时打包在项目的dist_electron目录
我查看了font-list的源码,mac打包会调用darwin/index.js,文件中使用了__dirname,该变量直接被解析成了dist_electron/,导致无法访问到fontlist.m脚本

@wxfred
Copy link
Author

wxfred commented Jul 1, 2021

@oldj webpack配置__dirname保持文件原始路径而不是打包后文件路径

config.node
  .set('__dirname', true)

electron调试模式可以正确获取到脚本文件

但是,electron打包成dmg安装后,直接白屏

我又测试了一下不修改webpack配置直接打包dmg,能够访问vue页面,但是获取不到字体信息,应该还是脚本路径的问题

@Beats0
Copy link

Beats0 commented Mar 22, 2022

see #29

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants