electron / electron/forge

`readPackageJson` not used by Webpack plugin

Open
#3,175 0 comments 0 reactions 0 assignees View on GitHub
bug 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.

### Electron Forge version

6.0.5

### Electron version

23.0.0

### Operating system

Latest macOS / Windows

### Last known working Electron Forge version

_No response_

### Expected behavior

The Webpack plugin gets `productName` from `readPackageJson` hook, allowing users to alter it using `buildIdentifier`. Calls to `app.getName()` return the `productName` from the `readPackageJson` hook.

### Actual behavior

The Webpack plugin gets `productName` from package.json directly. Calls to `app.getName()` return the `productName` from package.json directly.

### Steps to reproduce

1. Set the following in your package.json:
```
"productName": "Product Name",
```
2. Add the following to your forge.config.js:
```
hooks: {
readPackageJson: async (forgeConfig, packageJson) => ({
...packageJson,
productName: 'Custom Product Name',
}),
},
```
3. Run `yarn start`.
4. Observe that the window shows "Product Name" and not "Custom Product Name".

### Additional information

_No response_

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.