Skip to content

forge.config.js in packagerConfig.ignore Not processing all paths #3293

@ht-sauce

Description

@ht-sauce

Pre-flight checklist

  • I have read the contribution documentation for this project.
  • I agree to follow the code of conduct that this project uses.
  • I have searched the issue tracker for a bug that matches the one I want to file, without success.

Electron Forge version

6.2.1

Electron version

25.3.1

Operating system

Windows 10

Last known working Electron Forge version

6.2.1

Expected behavior

packagerConfig.ignore All paths should be processed

Actual behavior

I want to optimize the volume of packaged files and preserve specific files through the ignore function, but I found that the ignore function does not handle all paths
Please take a look at the ignore section in my code. This logic is very simple, but/node_ Modules/electric squirrel startup, some of which were not matched

Steps to reproduce

module.exports = {
  packagerConfig: {
    icon: 'public/icon',
    // asar: true,
    version: '1.0.0', // 应用程序版本号
    // 不需要打包的文件和文件夹的路径列表,true表示忽略,false表示包含
    ignore(path) {
      if (!path) return false
      if (path.includes('/node_modules/electron-squirrel-startup')) return false
      if (path.includes('/.vite')) return false
      if (path.includes('/package.json')) return false

      return true
    },
  },
  rebuildConfig: {},
  makers: [
    {
      name: '@electron-forge/maker-squirrel',
      config: {
        setupIcon: 'public/icon.ico',
      },
    },
    {
      name: '@electron-forge/maker-zip',
      platforms: ['darwin'],
    },
    {
      name: '@electron-forge/maker-deb',
      config: {
        options: {
          icon: 'public/icon.png',
        },
      },
    },
    {
      name: '@electron-forge/maker-rpm',
      config: {},
    },
  ],
  plugins: [
    {
      name: '@electron-forge/plugin-vite',
      config: {
        build: [
          {
            entry: 'src/main.js',
            config: 'vite.main.config.mjs',
          },
          {
            entry: 'src/preload.js',
            config: 'vite.preload.config.mjs',
          },
        ],
        renderer: [
          {
            name: 'main_window',
            config: 'vite.renderer.config.mjs',
          },
        ],
      },
    },
  ],
}

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugpackageIssues related to the `package` command

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions