question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Electron support via a plugin

See original GitHub issue

Description

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

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:3
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
astoilkovcommented, Oct 6, 2022

Following my previous point, we don’t have experience with Electron so moving it into core is hard for us to maintain. It might even slow down the development as PRs and releases have to be done by us.

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.

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.

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.

1reaction
bluwycommented, Oct 6, 2022

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Plugin Architecture for Electron apps - Part 1 - Beyond Code
Electron is a great framework, that allows you to write desktop applications using the tools that you as a web-developer already know: ...
Read more >
How to implement plugins into Electron app? - Stack Overflow
My idea was to develop plugins as vue plugins and publish via npm. I used live-plugin-manager to install and uninstall plugins. The dependencies ......
Read more >
pluggable-electron - npm
A framework to create a plugin API in Electron apps. Latest version: 0.6.0, last published: 2 months ago. Start using pluggable-electron in ...
Read more >
Using Pepper Flash Plugin · Electron documentation
Electron supports the Pepper Flash plugin. To use the Pepper Flash plugin in Electron, you should manually specify the location of the Pepper...
Read more >
Writing Plugins - Electron Forge
An Electron Forge Plugin has to export a single class that extends our base plugin. The base plugin can be depended on by...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found