electron / forge

:electron: A complete tool for building and publishing Electron applications
https://electronforge.io
MIT License
6.32k stars 489 forks source link

Plugins are ignored and nothing runs after the generateAssets hook #3561

Closed alfredomariamilano closed 2 months ago

alfredomariamilano commented 2 months ago

Pre-flight checklist

Electron Forge version

7.3.1

Electron version

29.2.0

Operating system

Windows 11 Pro (23H2)

Last known working Electron Forge version

7.3.1

Expected behavior

All plugins should run before trying to run the electron process from the main entry point.

Actual behavior

Plugins don't run at all, I've tried with both the Vite and the Webpack plugins and nothing seems to run anymore after the generateAssets hook. It goes straight to running electron, trying to execute the bundle that doesn't exist since Vite and Webpack don't run.

Steps to reproduce

I was using the Vite template first and then created a different project to try the Webpack template. Both worked great, but I was using Vite. Now I'm having issues, with Webpack being way more mature than Vite, so I copied the Webpack files to the Vite project just to try it out. I've changed the main in package.json and commented out Vite's plugin in forge.config. It was working fine, until I switched back to Vite and now neither works.

Additional information

⠋ Checking your system                                                                                                          
✔ Checking your system
[STARTED] Locating application
  electron-forge:project-resolver searching for project in: C:\Users\USER\development\PROJECT\desktop +0ms
  electron-forge:project-resolver package.json with forge dependency found in C:\Users\USER\development\PROJECT\desktop\package.json +1ms
[SUCCESS] Locating application
[STARTED] Loading configuration
[SUCCESS] Loading configuration
[STARTED] Preparing native dependencies
[TITLE] Preparing native dependencies
[SUCCESS] Preparing native dependencies
[STARTED] Running generateAssets hook
[SUCCESS] Running generateAssets hook
  electron-forge:start Electron binary path: C:\Users\USER\development\PROJECT\desktop\node_modules\electron\dist\electron.exe
 +0ms
alfredomariamilano commented 2 months ago

I am an idiot and I had changed the forge.config file to a .mts extension so it wasn't picking it up. It would be good for debugging to add the location of the config file that was loaded, with a warning if it is the default. I'll try to open a pull request for it.