capacitor-community / capacitor-community/electron

Unable to load preload script \@capacitor\electron\dist\electron-bridge.js

Open
#202 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
398
Forks
63
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**
Just migrated from electron 8.5.5 to 19.0.9 for an electron ionic desktop application project. When trying to open electron window with the command 'npx cap open electron', it throws an error: Unable to load preload script: ..electron\node_modules\@capacitor\electron\dist\electron-bridge.js

**Implementation**
```
mainWindow = new BrowserWindow({
width: 400,
height: 700,
resizable: false,
title: "Desktopia",
show: false,
icon: path.join(__dirname, 'favicon.ico'),
webPreferences: {
backgroundThrottling: false,
nodeIntegration: true,
preload: path.join(__dirname, 'node_modules', '@capacitor', 'electron', 'dist', 'electron-bridge.js')
}
});
```

**Expected behavior**
Electron window should open with the command 'npx cap open electron'

**Screenshots**
![image](https://user-images.githubusercontent.com/54796878/180452522-46a8e696-3b61-458b-ae59-3bc9a5af0b0e.png)
![image](https://user-images.githubusercontent.com/54796878/180452596-c7aa8fb3-df82-42be-9748-abc38e685fc9.png)

**Desktop (please complete the following information):**

- OS: Windows
- Version : 10

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.