electron / electron/forge

MAIN_WINDOW_PRELOAD_WEBPACK_ENTRY on WSL generates a linux path when Electron is looking for a windows path

Open
#2,828 1 comment 0 reactions 0 assignees View on GitHub
platform/windows plugin/webpack wsl
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-userland/electron-forge/blob/master/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.0-beta.63

### Electron version

v18.1.0

### Operating system

Windows 10

### Last known working Electron Forge version

_No response_

### Expected behavior

When using electron forge to develop electron app on Windows Subsystem for Linux 1 (haven't tried WSL2) I expect the MAIN_WINDOW_PRELOAD_WEBPACK_ENTRY value to be appropriately populated for the platform the app is to be run on (e.g. Windows). I expect the path to look like **"C:\\DevFolder\\AppFolder\\.webpack\\renderer\\main_window\\preload.js".**

### Actual behavior

When using electron forge to develop electron app on Windows Subsystem for Linux 1 (haven't tried WSL2) the MAIN_WINDOW_PRELOAD_WEBPACK_ENTRY value is **"/mnt/c/DevFolder/AppFolder/.webpack/renderer/main_window/preload.js"** which causes the runtime to complain with "preload script must have absolute path".

### Steps to reproduce

1. Create new project (I used react, typescript, webpack template) in WSL terminal on Windows 10
2. Add src/preload.ts file
3. Add "preload": { "js": "./src/preload.ts" }" block to "entryPoints" block in package.json
4. Set "webPreferences" : { preload: MAIN_WINDOW_PRELOAD_WEBPACK_ENTRY } from within in index.ts
5. $ npm start
6. Observer error in linux terminal

### 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.