Webpack Plugin: keytar.node is not a valid win32 application
- 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.4.2
### Electron version
26.2.1
### Operating system
Windows 11 (22621)
### Last known working Electron Forge version
_No response_
### Expected behavior
Using the webpack plugin with the Native Node Modules setup detailed in the [electronforge.io/config/plugins/webpack](url) works correctly
### Actual behavior
Instead, starting the application via `electron-forge start` results in the following error:
`Error: \\?\C:\Users\\src\\.webpack\main\native_modules\build\Release\keytar.node is not a valid Win32 application.`
### Steps to reproduce
Use electron forge with webpack plugin out of the box, as detailed in [electronforge.io/config/plugins/webpack](url), including the Native node Modules setup as detailed on that page, and the Auto Unpack Native Modules Plugin
Install and use `keytar`: `npm i --save-dev keytar`
import and use `keytar` in the main process
### Additional information
Config from `package.json`:
```
"config": {
"forge": {
"plugins": [
{
"name": "@electron-forge/plugin-webpack",
"config": {
"mainConfig": "./webpack.main.config.js",
"renderer": {
"config": "./webpack.renderer.config.js",
"entryPoints": [
{
"name": "main_window",
"html": "./src/index.html",
"js": "./src/renderer.js",
"preload": {
"js": "./src/preload.js"
}
}
]
}
}
}
]
}
}
```
forge.config.js file:
```
module.exports = {
packagerConfig: {
asar: true,
},
rebuildConfig: {},
makers: [
{
name: '@electron-forge/maker-squirrel',
config: {},
},
{
name: '@electron-forge/maker-zip',
platforms: ['darwin'],
},
{
name: '@electron-forge/maker-deb',
config: {},
},
{
name: '@electron-forge/maker-rpm',
config: {},
},
],
plugins: [
{
name: '@electron-forge/plugin-auto-unpack-natives',
config: {},
},
{
name: '@electron-forge/plugin-webpack',
config: {
mainConfig: './webpack.main.config.js',
renderer: {
config: './webpack.renderer.config.js',
entryPoints: [
{
html: './src/index.html',
js: './src/renderer.js',
name: 'main_window',
preload: {
js: './src/preload.js',
},
},
],
},
},
},
],
};
```
Contributor guide
Assessment
This issue has not been assessed yet.