Vue CLI Plugin Electron Builder 自定义应用图标

6 min read

Vue CLI Plugin Electron Builder

文档

https://nklayman.github.io/vue-cli-plugin-electron-builder/guide/guide.html#is-this-plugin-production-ready

Simply add an icons/icon.png file to the build resources directory (opens new window)and electron-builder will use it on all platforms. Unless you have manually configured the build resources directory, the icon should go in build/icons/icon.png, relative to your app’s root.

配置项

module.exports = {
    //...
    pluginOptions: {
        electronBuilder: {
            preload: 'src/preload.js',
            builderOptions: {
                mac: {
                    icon: 'build/icons/icon.png'
                }
            }
            // Or, for multiple preload files:
            // preload: { preload: 'src/preload.js', otherPreload: 'src/preload2.js' }
        },
    },
    //...
};