xiefengnian / umijs-electron-plugin

Easily build Electron app using umi
Apache License 2.0
15 stars 6 forks source link

配置应用icon不生效 #14

Closed klausxie closed 1 year ago

klausxie commented 1 year ago

.umirc.ts 配置如下

import { defineConfig } from 'umi';
import { Platform, Arch } from '@umijs/plugin-electron';

export default defineConfig({
  npmClient: 'yarn',
  plugins: ['@umijs/plugin-electron'],
  electron: {
    builder: {
      targets: Platform.MAC.createTarget(['dmg'], Arch.x64),
      config: {
        mac: {
          icon: "build/icons/icon.icns",
        }
      },
    }
  },
});

项目目录结构:

app
  - build/icons/icon.icns
  - node_modules
  - src
  - .umirc.ts

构建出现提示: default Electron icon is used reason=application icon is not set

klausxie commented 1 year ago

找到问题了

build 目录需求放在 .electron-production 目录下

app
  - .electron-production/build/icons/icon.icns
  - node_modules
  - src
  - .umirc.ts