Skip to content

Webpack: preload-only entries overwrite renderer URL defines #4454

Description

@clavin

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.

Forge version

7.8.1

Electron version

44.9.1

Operating system

macOS 26.7.1 arm64

Last known working Forge version

No response

Expected behavior

MAIN_WINDOW_WEBPACK_ENTRY resolves to main_window/index.html, regardless of group order.

Actual behavior

A preload-only entry overwrites it with main_window/index.js, although that entry builds no renderer script. This then loads JavaScript instead of HTML:

window.loadURL(MAIN_WINDOW_WEBPACK_ENTRY);

Steps to reproduce

Configure separate renderer groups for a page and a preload-only entry with the same name, placing the preload group last:

renderer: [
  {
    config: {
      optimization: {
        splitChunks: { chunks: 'all', minChunks: 2 },
      },
    },
    entryPoints: [
      {
        name: 'main_window',
        html: './src/index.html',
        js: './src/renderer.js',
      },
    ],
  },
  {
    config: {},
    entryPoints: [
      {
        name: 'main_window',
        preload: { js: './src/preload.js' },
      },
    ],
  },
],

Additional information

Separate groups allow page scripts to share chunks while keeping preloads self-contained. At present, they must be ordered with the page group last to produce the correct URL.

Activity

  1. added theissue type on Oct 28, 2026
  2. ykakade commented on Oct 28, 2026

    @ykakade

    @clavin I have opened a PR to fix this #4455

  3. erickzhao commented on Oct 31, 2026

    @erickzhao
    Member

    @clavin Would this work for you?

    {
      config: { optimization: { splitChunks: { chunks: 'all', minChunks: 2 } } },
      entryPoints: [{
        name: 'main_window',
        html: './src/index.html',
        js: './src/renderer.js',
        preload: { js: './src/preload.js', config: {} },
      }],
    }
  4. self-assigned this
    on Oct 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions