Closed naxiemolv closed 2 months ago
我遇到了类似问题,mac下打包安装后运行时收到错误提示
Error: Cannot find module 'font-list'
把asar拆开发现node_modules目录中没有font-list目录,app.asar.unpacked 中也没有
环境如下
"devDependencies": {
"@vue/cli-plugin-babel": "~4.5.0",
"@vue/cli-plugin-eslint": "~4.5.0",
"@vue/cli-service": "^4.5.13",
"babel-eslint": "^10.1.0",
"electron": "^11.0.0",
"electron-builder": "^22.10.5",
"electron-devtools-installer": "^3.1.0",
"eslint": "^6.7.2",
"eslint-plugin-vue": "^6.2.2",
"vue-cli-plugin-electron-builder": "^2.0.0",
"vue-template-compiler": "^2.6.11"
},
谢谢
@bergkamp 你的打包命令或者脚本是怎样的?去掉敏感信息后贴一下呢?
@oldj
命令很简单 vue-cli-service electron:build
以下是vue.config.js的内容
module.exports = {
configureWebpack: {
devtool: 'source-map',
devServer: {
host: 'localhost',
},
},
pluginOptions: {
electronBuilder: {
nodeIntegration: true,
builderOptions: {
productName: "xxxx",
appId: 'xxxx',
mac: {
icon: './src/icons/icon.icns',
},
win: {
icon: './src/icons/icon.png',
target: 'nsis'
},
nsis: {//https://www.electron.build/generated/nsisoptions
oneClick: false,
allowToChangeInstallationDirectory: true,
createDesktopShortcut: true
},
mas: {
hardenedRuntime: false,
type: "distribution",
entitlements: "build/entitlements.mas.plist",
entitlementsInherit: "build/entitlements.mas.inherit.plist",
category: "public.app-category.photography",
provisioningProfile: "build/zxxx.provisionprofile"
},
masDev: {
hardenedRuntime: false,
type: "development",
entitlements: "build/entitlements.mas.plist",
category: "public.app-category.photography",
provisioningProfile: "build/zxxx.provisionprofile",
},
extraFiles: [
{
from: "static",
to: "static"
}
]
}
}
}
}
see #29
不能正常装进 app.asar