Skip to content

Regression in v7.8.1: index.html no longer listed in Webpack assets #3949

Open

Description

@nikwen

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

36.4.0

Operating system

Windows 10 (19045.5854)

Last known working Forge version

7.8.0

Expected behavior

Webpack plugins see my renderer's index.html as an asset when calling compilation.getAssets().

Actual behavior

Starting with Forge v7.8.1, Webpack plugins do not see my renderer's index.html as an asset when calling compilation.getAssets() on Windows. (It works fine on macOS.)

This broke the build script of my app.

Steps to reproduce

  1. Clone https://github.com/nikwen/forge-jiti-bug
    • This repo consists of two commits:
      1. 507f56c: The unchanged output of npx create-electron-app@latest forge-jiti-bug --template=webpack-typescript (with Forge v7.8.1)
      2. 83fb84f: Adding a minimal Webpack plugin that logs the result of compilation.getAssets()
  2. npm install
  3. npm start
  4. The output is:
    main_window/preload.js
    main_window/index.js
    
    (This is the list of assets that Webpack plugins see on Forge v7.8.1.)
  5. git checkout forge-v7.8.0
    • This branch has one additional commit d5ef061: Downgrading Forge to v7.8.0
  6. npm install
  7. npm start
  8. The output is:
    main_window/preload.js
    main_window/index.js
    main_window/index.html
    
    (This is the expected behavior — the list of assets that Webpack plugins see on Forge v7.8.0.)

Additional information

  1. This works fine on macOS.
  2. This was introduced by fix(core): load TypeScript configurations with jiti #3907 (the jiti PR).
  3. It broke the build script of my app.
  4. Workaround: renaming forge.config.ts to forge.config.tsx (because jiti isn't used for .tsx files)

Activity

  1. added theissue type on Jun 9, 2025
  2. self-assigned this
    on Jun 9, 2025
  3. added
    plugin/webpack
    on Jun 9, 2025
  4. nikwen commented on Jun 10, 2025

    @nikwen
    MemberAuthor

    I think this is the root cause:

    On v7.8.0, Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_TRANSFER is 3000.
    On v7.8.1, Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_TRANSFER is undefined.

    If I set stage: undefined on v7.8.0, I get the same behavior there.

    v7.8.1 imports Compilation as a function whereas v7.8.0 imports Compilation as an object.

  5. claude commented on Jul 1, 2026

    @claude
    Contributor

    Thanks for the detailed repro, @nikwen. I tried to reproduce this on Linux using your forge-jiti-bug setup — stock webpack-typescript template on Forge 7.8.1, config kept as forge.config.ts so the jiti loader from #3907 is in play (webpack 5.108.3, jiti 2.7.0) — and index.html is emitted normally. compilation.getAssets() at PROCESS_ASSETS_STAGE_OPTIMIZE_TRANSFER includes main_window/index.html, and the file is written to .webpack/renderer/main_window/.

    Looking at the mechanism on Linux: there's a single shared webpack/Compilation in require.cache, Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_TRANSFER is 3000 (not undefined), and the Compilation the jiti-loaded plugin imports is identical (===) to the one the build uses. typeof Compilation === "function" does hold under the jiti path here too, but the static stage constant is still intact — so that part alone doesn't seem sufficient to cause the drop.

    Since it looks Windows-specific and I can't trigger it on Linux, could you reconfirm it still reproduces on your Windows setup with current versions? If it does, it'd help a lot to see, from inside your plugin on Windows:

    • the value and typeof of Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_TRANSFER, and
    • whether there's more than one webpack/lib/Compilation.js entry in require.cache (i.e. more than one loaded Compilation class).

    That would confirm whether this is jiti loading a second webpack copy via Windows path casing, which is our leading theory.

  6. nikwen commented on Jul 1, 2026

    @nikwen
    MemberAuthor

    Still repros, of course, and it is Windows-only as mentioned in the description.

  7. claude commented on Jul 1, 2026

    @claude
    Contributor

    Working with Samuel Attard

    hello there this is a test

  8. claude commented on Jul 1, 2026

    @claude
    Contributor

    Working with @MarshallOfSound

    one more test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugplatform/windowsplugin/webpack

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions