electron / electron/forge

Unable to load preload script with latest package @vercel/webpack-asset-relocator-loader@1.10.0

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

### Forge version

7.8.1

### Electron version

v36.5.0

### Operating system

Windows 11 企业版 LTSC

### Last known working Forge version

7.8.1

### Expected behavior

renderer with no error

### Actual behavior

renderer with error in electron window dev tool, and window is blank
```
VM4 sandbox_bundle:2 Unable to load preload script: C:\Users\AI\Desktop\ai-learning-assistant-launcher\.webpack\renderer\main_window\preload.js
executeSandboxedPreloadScripts @ VM4 sandbox_bundle:2
VM4 sandbox_bundle:2 ReferenceError: __dirname is not defined
at :389:84
at :1412:12
at runPreloadScript (VM4 sandbox_bundle:2:144346)
at executeSandboxedPreloadScripts (VM4 sandbox_bundle:2:143619)
at VM4 sandbox_bundle:2:154017
at VM4 sandbox_bundle:2:154219
at ___electron_webpack_init__ (VM4 sandbox_bundle:2:154223)
at VM4 sandbox_bundle:2:154346
executeSandboxedPreloadScripts @ VM4 sandbox_bundle:2
index.js:33520 Uncaught ReferenceError: __dirname is not defined
at index.js:33520:84
at index.js:34614:12
VM4 sandbox_bundle:2 Electron Security Warning (Insecure Content-Security-Policy) This renderer process has either no Content Security
Policy set or a policy with "unsafe-eval" enabled. This exposes users of
this app to unnecessary security risks.

For more information and help, consult
https://electronjs.org/docs/tutorial/security.
This warning will not show up
once the app is packaged.
warnAboutInsecureCSP @ VM4 sandbox_bundle:2

```

Image

### Steps to reproduce

```
git clone https://github.com/ai-learning-assistant-dev/ai-learning-assistant-launcher.git
git checkout - b shiftonetothree_dev origin/shiftonetothree_dev
npm i
nom i @vercel/webpack-asset-relocator-loader@latest
npm run start
```

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