forge: Undocumented breaking change for Vite plugin in v7.3.0
Pre-flight checklist
- I have read the contribution documentation for this project.
- I agree to follow the code of conduct that this project uses.
- I have searched the issue tracker for a bug that matches the one I want to file, without success.
Electron Forge version
7.3.0
Electron version
N/A
Operating system
All
Last known working Electron Forge version
7.2.0
Expected behavior
Upgrading your Vite plugin app from Electron Forge v7.2.0 to v7.3.0 is seamless.
Actual behavior
Changes in the build system during the upgrade to Vite 5 have produced an API-incompatible change, requiring users to upgrade.
Steps to reproduce
N/A
Additional information
To fix this issue, see the @electron-forge/template-vite
template config files: https://github.com/electron/forge/tree/main/packages/template/vite/tmpl
About this issue
- Original URL
- State: open
- Created 4 months ago
- Reactions: 12
- Comments: 31 (5 by maintainers)
Commits related to this issue
- Fix desktop builds See https://github.com/electron/forge/issues/3506 — committed to ystv/badger by markspolakovs 2 months ago
Chiming in here… I’ve been using configs based on modified 7.2.0 templates (vite + electron + svelte! 😉 ).
Upgrading to 7.3.0 causes my existing configs to … just not produce any output! (.vite/build/… empty: no main.js found).
I think I might be able to get things to work if I rebuild the changes in my templates on top of the new ones, but that seems involved for a minor release.
Note: I don’t think it’s the vite@5 update that’s causing my issue, as my package.json already specified
"vite": "^5.2.6"
@caoxiemeihao I am fairly well versed in forge and vite but there is so much conversation here (and in other gh issues) about what needs to be patched where and what forge version and running migration scripts etc etc that I am confused and a bit lost.
Is it possible that you publish a minimal working template repo that has everything we need with forge 7.4 to work with forge-vite-typescript and ESM (type: module)? Basically what the vite typescript template should do (but it sounds like there are reasons why the template can’t work or something?).
I just think we need some “official” docs / direction that will also be maintained / supported by forge long term otherwise it will turn into a maintenance nightmare. Thanks!
Can you provide a migration guide, to fix this issue?
@GitMurf That is my understanding 👍 As @VerteDinde mentioned above we’re looking into options here, the issue is the breaking change is bidirectional. i.e. straight up reverting won’t help because then new apps will be broken in the opposite way to old apps. Right now you should pin to a version of forge that works for your app, and we’ll figure out how to make a way forward to higher forge versions.
Hey folks, sorry for our delay - we spoke about this in a maintainer meeting today. We’re deciding on a path forward, but wanted to briefly update the issue letting you know that there are currently eyes on this and we should be reporting back with fixes shortly.
Personally, the way this “migration” is being handled makes me want to run for the hills. I don’t think it is acceptable that an upgrade from 7.2 to 7.3 breaks my code, without any warning. The reason I am using something like forge in the first place is because I don’t want to look below the abstraction that covers all the messy details.
I’m a little concerned that this migration guide is implying the de-facto official path uses
electron-forge-plugin-vite
, which is maintained in a repo under @caoxiemeihao’s personal control.Ideally any migration utility should be contributed and maintained under
electron/forge
You only see that there is an increase in template code for
v7.3.0
, and you have overlooked what the approach ofv7.3.0
brings and what incompatible aspects of Forge itself have been avoided.hot-restart
andhot-reload
is very popular inelectron-vite
andtauri
, but implementing this feature in Forge without authorization can damage Forge’s own design. It’s simply impossible to advance.{"type": "module"}
in thepackage. json
of@electron-forge/plugin-vite
, which is fatal for frameworks likesvelte
, as Forge itself is built in the format ofCommonsJS
(tsconfig. json) and cannot risk switching toESNext
entirely due to thevite-template
.BTW, if you feel that there is too much
@electron-forge/template-vite
code, it is recommended that you useelectron-vite
(even without a separate config file, really simplify) or other frameworks.Migrate to
7.3.0+
vite.main.config.ts
vite.renderer.config.ts
vite.preload.config.ts
+1 !
Do you mind pointing to the change that fixed the issue? There seems to be a lot going on there. Here’s my files: https://github.com/will-stone/browserosaurus