-1

I'm using the boilerplate from electron-forge to construct an electron app that I would like to package. The main window is wrapped in an additional "gate" window that I'm using as a license check.

in main.ts, the relevant code:

const gateCreateWindowWithLicense = async (createWindow: any) => {
  const path = require('path');
  

  gateWindow = new BrowserWindow({
    resizable: false,
    frame: false,
    width: 420,
    height: 200,
    webPreferences: {
      preload: path.join(__dirname, '/gate.js'),
      devTools: isDebug,
    },
  });
  gateWindow.loadFile(`${__dirname}/gate.html`);

The structure of the project is:

-project\
--node_modules\
--src\
----render\
----main\
------gate.css\
------gate.html\
------gate.js\
------main.ts\
------preload.ts\
------menu.ts

When I package and attempt to run the app, it just loads a blank white screen that is the size of the gate window (but no other controls/features). When I launch the app locally via commandline (found inside /release/build):

(base) user@computer:~/project/release/build$ ./project.AppImage 
(node:2740) electron: Failed to load URL: file:///tmp/.mount_EspritQdcf5k/resources/app/gate.html with error: ERR_FILE_NOT_FOUND

How do I make it so that all of the gate files are moved in with the project? I've read about the "files" tag in project.json but I dont know where the "to" directory is after its been packaged.

DrTchocky
  • 515
  • 1
  • 5
  • 14
  • do you use your own webpack config OR webpack-plugin? what does your forge config look like. what boilerplate you mean? you can setup forge in different ways. forge has "out" as output not "release/build" – Welcor Mar 09 '23 at 21:56
  • and do not mix up electron-bulder with electron-forge. they are different and not used together. – Welcor Mar 09 '23 at 22:01

1 Answers1

0

This was a weird webpack issue that was moving files around during packaging.

DrTchocky
  • 515
  • 1
  • 5
  • 14