I’m new with Electron and I’m trying to build an app using electron-forge and Vite. I want to create multiple windows, so I’m creating separate folders to group the html and preload files.
I have to add these preload files to Vite so that it can build them but when I do it in the Rollap config Vite keeps compiling forever. You can view the full project right here.
I’ve added the preload scripts as it’s described in the Vite documentation, and when I do it with a single file works fine (the compiled file it’s generated in .vite/build
). My problem it’s when I add the second one, it keeps compiling forever.
To replicate it follow this steps:
git clone https://github.com/MarkelCA/electron-ts-scaffold.git
cd electron-ts-scaffold
npm i
npm start // This should work fine
// Now uncomment the line from vite.preload.config.ts:16
// It'll keep stuck at this step:
// ⠹ [plugin-vite] Compiling main process code
I’ve also tried to disable the watch mode replacing the following line: vite.base.config.ts:21
with this one: watch: null,
and now it finishes the process but compiles nothing (leaves no preload script the .vite/build
folder)