Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Electron change hostname

My Capacitor Electron app starts with hostname hyphen(-)

    capacitor-electron://-/

I want to change the hostname to some string, but can't find any option for this.

    capacitor-electron://abc/
like image 638
Niels Steenbeek Avatar asked Apr 17 '26 17:04

Niels Steenbeek


1 Answers

Make sure that you are using at least version 1.2 of the electron-serve package in electron/package.json (not in the main package.json)

Then, add hostname option to the electronServe call in electron/src/setup.ts:

// Setup our web app loader, this lets us load apps like react, vue, and angular without changing their build chains.
this.loadWebApp = electronServe({
  directory: join(app.getAppPath(), 'app'),
  scheme: this.customScheme,
  hostname: 'abc',
});
like image 158
Pavel Chuchuva Avatar answered Apr 20 '26 12:04

Pavel Chuchuva