electron / electron/forge

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

Open
#3,949 5 comments 0 reactions 1 assignee Claimed by @erickzhao View on GitHub
bug platform/windows plugin/webpack
Dominant language
TypeScript
Stars
7.1k
Forks
641
Avg merge
3d 1h
Merged PRs (30d)
30

Description

### Pre-flight checklist

- [x] I have read the [contribution documentation](https://github.com/electron/forge/blob/main/CONTRIBUTING.md) for this project.
- [x] I agree to follow the [code of conduct](https://github.com/electron/electron/blob/main/CODE_OF_CONDUCT.md) that this project uses.
- [x] 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](https://github.com/nikwen/forge-jiti-bug/commit/507f56ceb900dbee3728e7fdedf20336cf22bc19): The unchanged output of `npx create-electron-app@latest forge-jiti-bug --template=webpack-typescript` (with Forge v7.8.1)
2. [83fb84f](https://github.com/nikwen/forge-jiti-bug/commit/83fb84ff39560388e4a6f5ca945b4a7604357044): 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](https://github.com/nikwen/forge-jiti-bug/commit/d5ef0610664a5609845aac4fc879150547c077bd): 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 https://github.com/electron/forge/pull/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)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.