electron / electron/forge

__webpack_require__.ab is undefined on Windows

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

### Electron Forge version

6.2.1

### Electron version

24.1.2

### Operating system

Windows 11

### Last known working Electron Forge version

_No response_

### Expected behavior

Have this line defined on the .webpack/main bundle:

`if (typeof __webpack_require__ !== 'undefined') __webpack_require__.ab = __dirname + "/native_modules/";`

### Actual behavior

This line
`if (typeof __webpack_require__ !== 'undefined') __webpack_require__.ab = __dirname + "/native_modules/";`
is completely missing from the webpack main process bundle

### Steps to reproduce
- Create a new project with the webpack template
- Use a native node module in windows and run `npm start`

### Additional information

Very similar to this issue https://github.com/electron/forge/issues/3183. It would be a bummer to have to switch to something different from electron-forge

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.