Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile executables with Vite build --compile #16537

Closed
4 tasks done
darkgreentree opened this issue Apr 26, 2024 · 2 comments
Closed
4 tasks done

Compile executables with Vite build --compile #16537

darkgreentree opened this issue Apr 26, 2024 · 2 comments

Comments

@darkgreentree
Copy link

darkgreentree commented Apr 26, 2024

Description

Bun package manager just created something that, although very convenient, I consider that this innovation would be better in Vite's scope: a simple CLI command that compiles the Vite project in a few seconds to a Windows/MacOS/Linux executable. https://bun.sh/blog/bun-v1.1.5#cross-compile-standalone-executables-with-bun-build-compile

Not necessarily this is to be a feature to be developed inside Vite. Just like Vitest is another project under your umbrella, there could be a project of yours just focused to create these executables/apps to different platforms.

Not always I may install Bun as package manager, so this task to create an executable remains a complicated process, most popular achieved with Electron or Tauri to build executables to PCs. Mobile executables are even worse. Also, many pre-requisites need to be installed in order to Electron or Tauri to work, and also so many options to be configured. So I found it fascinating to see Bun achieving a simple solution.

Bun has achieved it with another limitation in my eyes. Although being straight to the point, Bun tends to be a closed ecosystem, I don't know if they allow plugins yet to extend their features. Vite is always more diverse, and allows plugins, Vite already deals with the build process, all in a single config file, Vite is in my opinion more aligned to the future of JavaScript instead of Bun (rollup/Rust structure/lightningcss), so I was just imagining if this feature could be developed natively in Vite ecossystem.

Suggested solution

To draw inspiration from Bun single-file executable in order to easily build app executables.
https://bun.sh/docs/bundler/executables

Or to serve APIs that could be used by Tauri/Electron or by a plugin, instead of them doing everything dissociated from Vite.

Alternative

No response

Additional context

No response

Validations

@darkgreentree darkgreentree changed the title Cross-compile executables with vite build --compile Compile executables with Vite build --compile Apr 26, 2024
@darkgreentree
Copy link
Author

I would like to note that when Bun tries to create an executable, it doesn't work well with Vite projects, because Bun imports assets with a different syntax from the one allowed in Vite: https://bun.sh/docs/bundler/executables#embed-assets-files
That is another incentive for having this feature to be developed in Vite.

@bluwy
Copy link
Member

bluwy commented Apr 29, 2024

I think like Vitest, this is out of scope for Vite at the moment, and should be developed externally if you have interest in this. We currently can't carry the additional maintenance for this feature.

@bluwy bluwy closed this as not planned Won't fix, can't repro, duplicate, stale Apr 29, 2024
@bluwy bluwy mentioned this issue Apr 29, 2024
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants