我正在使用 WSL2 并成功运行
npm run make
开
...
"scripts": {
...,
"make": "electron-forge make"
},
...
但是在创建可分发文件时,它仅创建
✔ Making distributables
✔ Making a deb distributable for linux/x64 [12s]
✔ Making a rpm distributable for linux/x64 [25s]
有什么方法可以让 Electron-forge 也为 Windows 输出 exe 吗?
这是示例 forge 配置文件设置,它允许我的 GitHub 操作生成多个供应商可执行文件
module.exports = {
packagerConfig: {},
rebuildConfig: {},
makers: [
{
name: "@electron-forge/maker-squirrel",
config: {},
},
{
name: "@electron-forge/maker-zip",
platforms: ["darwin"],
},
{
name: "@electron-forge/maker-dmg",
platforms: ["darwin"],
},
{
name: "@electron-forge/maker-deb",
config: {},
},
{
name: "@electron-forge/maker-rpm",
config: {},
},
],
plugins: [
{
name: "@electron-forge/plugin-webpack",
config: {
devContentSecurityPolicy: `default-src * self blob: data: gap:; style-src * self 'unsafe-inline' blob: data: gap:; script-src * 'self' 'unsafe-eval' 'unsafe-inline' blob: data: gap:; object-src * 'self' blob: data: gap:; img-src * self 'unsafe-inline' blob: data: gap:; connect-src self * 'unsafe-inline' blob: data: gap:; frame-src * self blob: data: gap:;`,
mainConfig: "./webpack.main.config.js",
renderer: {
config: "./webpack.renderer.config.js",
entryPoints: [
{
html: "./src/index.html",
js: "./src/renderer.js",
name: "main_window",
preload: {
js: "./src/preload.js",
},
},
],
},
},
},
],
publishers: [
{
name: "@electron-forge/publisher-github",
config: {
repository: {
owner: "rsathishtechit",
name: "udeler-pro",
},
prerelease: true,
},
},
],
};
上述配置的输出
知道这是一个老问题,但由于它尚未得到解答..
Electron 发行包大多数是在自己的平台上“构建”的,如果您在 WSL 上,则只能为 Linux 构建,要为 Windows 构建,请转到 Windows 计算机,您还需要配置 Squirrel(如果使用 Forge),如下所示:
makers: [
{
name: '@electron-forge/maker-squirrel',
config: {
name: 'EDHM-UI-V3',
authors: 'Blue Mystic',
description: 'Mod for Elite Dangerous to customize the HUD of any ship.',
setupExe: 'EDHM-UI-Installer.exe',
shortcutFolderName: 'EDHM-UI-V3',
appCopyright: 'Blue Mystic - 2025',
icon: path.join(__dirname, 'src/images/ED_TripleElite.ico'),
iconUrl: path.join(__dirname, 'src/images/ED_TripleElite.ico'),
setupIcon: path.join(__dirname, 'src/images/ED_TripleElite.ico'),
loadingGif: path.join(__dirname, 'src/images/loading.gif'),
certificateFile: './EDHM-UI-V3.pfx',
certificatePassword: '**********'
}
},