Support electron-builder in mac
__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?
Do you have more information? My project is also packaged using electron-builder, and everything seems to go well.
@oldj 我使用的是vue-cli-plugin-electron-builder,mac下electron调试,代码会被临时打包在项目的dist_electron目录
我查看了font-list的源码,mac打包会调用darwin/index.js,文件中使用了__dirname,该变量直接被解析成了dist_electron/,导致无法访问到fontlist.m脚本
@oldj webpack配置__dirname保持文件原始路径而不是打包后文件路径
config.node
.set('__dirname', true)
electron调试模式可以正确获取到脚本文件
但是,electron打包成dmg安装后,直接白屏
我又测试了一下不修改webpack配置直接打包dmg,能够访问vue页面,但是获取不到字体信息,应该还是脚本路径的问题
see #29