Package throw a Javascript error When I use electron-forge --template=webpack create a prjoect and use iohook in it.
- 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.4
### Electron version
12.0.0
### Operating system
macOs 12.1
### Last known working Electron Forge version
6.0.4
### Expected behavior
Open app without error.
### Actual behavior
It's normal in development environment, but throw error when I use electron-forge make to build a dmg package and open it.

### Steps to reproduce
1) use `yarn create electron-app --template=webpack` to create a new project.
2) change electron version to suit iohook `yarn add electron@12.0.0`
3) change node version to suit iohook `nvm use 14.21.2`
4) package.json add
```
"iohook": {
"targets": [
"node-83",
"electron-87"
],
"platforms": [
"win32",
"darwin",
"linux"
],
"arches": [
"x64",
"ia32"
]
}
```
5) `yarn add iohook`
6) webpack.main.config.ts add a line: `externals: ['iohook']`
7) use iohook in src/index.ts:` import ioHook from 'iohook'; ioHook.start();`
8) yarn start: run successfully
9) yarn make, build and install successfully, but open failure.
### Additional information
It's normal when I use other electron cli to create a new project and add iohook in project. So I think it's something omit in webpack.config.ts or forge.config.ts, to ensure build successfully when use iohook.
Thank you very much.
Contributor guide
Assessment
This issue has not been assessed yet.