Open ioV9x opened 3 days ago
Hi @ioV9x! Thanks for the report. From my initial read, I think this is a valid bug and we should take a look.
After many hours, I have managed to get ESM compilation working based on electron-vite-samples found in https://github.com/electron/forge/pull/3572. Im not entirely sure what did it, however I am using version 7.5.0. https://gist.github.com/Denyol/ff9f1800f1c0d953a2eb69f47c143fd5
@Denyol please double check your logs. In my case the ESM and CJS builds race and I suspect that you just were lucky that the ESM build won the race.
@Denyol please double check your logs. In my case the ESM and CJS builds race and I suspect that you just were lucky that the ESM build won the race.
That is strange, I was experiencing some builds failing due to compiling as CJS, trying again and it works seemingly randomly. Please point me in the direction of where I could find build logs.
We did not make any changes to the build format.
7.4.0
7.5.0
Pre-flight checklist
Electron Forge version
0.7.5
Electron version
32.1.1
Operating system
Windows 11
Last known working Electron Forge version
0.7.4
Expected behavior
I started with a template from 0.7.4 and I configured vite to output ESM like so (I don't remember whether it was the default back then or not):
I expect ESM only output and a working build.
Actual behavior
vite outputs both ESM and CJS to the same file whereas they sometimes contain artifacts of each other due to differing file lengths. The build console output of
electron-forge start
points in this direction, too:However, final proof can be obtained by
and indeed I my build directory contains:
Steps to reproduce
See expected behaviour.
Additional information
I use a few vite ESM-only APIs (like
import.meta.glob()
) and therefore cannot switch to CJS.I noted that you dropped compatibility guarantees, but I thought that this would qualify as a breaking config change. I highly suspect that other vite array-options can't be overwritten as well.