Electron support via a plugin
See original GitHub issueDescription
For weeks now I’ve been struggling to move our Electron app to Vite.
When building for the Electron renderer process you need to handle: node imports, node:
imports, node native modules, node globals, electron
imports, electron
imports in Web Workers. There are more, I just don’t understand enough to list them.
If dev mode works, the build may not work (and vice-versa).
Suggested solution
I suggest Vite adds support for Electron via a plugin.
I realize that may be out of scope at least for now but at least people can find this issue and see a comment from the maintainers so they can decide on their next steps.
I will also share any significant progress I have in the comments.
Alternative
An open-source plugin/boilerplate by non-Vite maintainers could be a solution. There are currently some projects but I don’t consider them mature — hard to work with, don’t support a use case, and have bugs.
Additional context
I want to provide an overview of what I’m proposing:
Vite doesn’t have any limitations for supporting Electron, it comes down to configuration. The Vite team is probably the most knowledgeable about what that configuration should be. I think it would be great for people to not spend a lot of time configuring Electron projects.
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn’t already an issue that request the same feature to avoid creating a duplicate.
Issue Analytics
- State:
- Created a year ago
- Reactions:3
- Comments:7 (4 by maintainers)
Yep, this makes sense. If none of you use/understand Electron it’s not viable. Please keep in mind this thread for the future. At some point, a new member can join that understands it. Electron isn’t a small niche. Most people program on an Electron app (VSCode) and the GitHub repo has 104k stars.
That is indeed great and will make it easier for Electron developers to choose https://github.com/electron-vite. @caoxiemeihao you can even mention your role in your repos readmes.
Thanks for your efforts @caoxiemeihao on getting Electron support working! You can join http://chat.vitejs.dev (if you’re not already in) and ping
@patak
in one of the channels, so we can add the role.Closing this for now as we’re not planning on first-class Vite plugin for Electron.