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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds Bun support #392

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open

Conversation

pftg
Copy link
Contributor

@pftg pftg commented Aug 5, 2023

Description 馃摉

Adds support of Bun

Background 馃摐

Lately, Bun has adopted Vite, so we can use it for compilation assets.

@pftg pftg changed the title WIP: Adds Bun support Adds Bun support Sep 8, 2023
@pftg pftg changed the title Adds Bun support WIP: Adds Bun support Sep 8, 2023
@vitalyliber
Copy link

It will be great to see the Bun support!

@pftg
Copy link
Contributor Author

pftg commented Sep 13, 2023

@vitalyliber left to fix tests ;( but you can use my pr to confirm at least this "fast" workaround works for you too

@pftg pftg changed the title WIP: Adds Bun support Adds Bun support Sep 14, 2023
@pftg
Copy link
Contributor Author

pftg commented Sep 14, 2023

@ElMassimo please review this PR

Notes:

This is a very naive approach to start using it. I already use it for my projects.
Later, I saw some ideas to encapsulate all those package managers: remove duplication to find the current package manager.

@pftg pftg marked this pull request as draft September 18, 2023 17:10
@pftg
Copy link
Contributor Author

pftg commented Sep 18, 2023

I found some strange issue: (!) "base" option should start with a slash.

@vladimirtemnikov
Copy link
Contributor

Hello, @pftg

Currently, bun does not support brotli: oven-sh/bun#267

ViteRuby could work with bun, but we have vite-plugin-rails, which depends on brotli compression currently, may be we should wait some time before brotli will be implemented or conditionally enable brotli in plugin?

@ElMassimo any thoughts on this?

@pftg
Copy link
Contributor Author

pftg commented Sep 19, 2023

@vladimirtemnikov Yeah, you are right.

I had to disable brotli by the way, to use this version. So if this is a hard requirement to support the compress plugin, then there is a workaround.

So, for now, I use compress: { brotli: false } to use a bun. I'm ok with that ;)

I think better to start using without brotli to find more issues

@pftg pftg marked this pull request as ready for review October 15, 2023 10:39
@pftg
Copy link
Contributor Author

pftg commented Oct 15, 2023

@vladimirtemnikov @ElMassimo updated PR, what do you think to add notice in the Readme that it's not compatible with the vite rails plugin and list of supported bun versions?

@pftg
Copy link
Contributor Author

pftg commented Oct 16, 2023

Hmm, for development mode, everything was fine, but as soon as I tried to run on Heroku with production mode, the compilation got stuck. I found that when removing RubyPlugin, it's not stuck. I need help to set env to see the real problem. I'll try to look into it later.

Will be great to find a guide on how to set up development env for those plugins with bun and with integration testing in the real app.

@pftg pftg marked this pull request as draft October 16, 2023 10:10
@dominikklein
Copy link

Any ideas to bring this forward? Also rails 7.1. has now bun support. Would be nice to when it can also be used in the vite-ruby/rails context.

@pftg
Copy link
Contributor Author

pftg commented Mar 5, 2024

Yeah need to check latest tests, maybe now it's working. For now I'm using this approach to use bun https://jtway.co/integrating-bun-with-vite-ruby-for-lightning-fast-frontend-builds-bbd220fefdc0

@pftg pftg force-pushed the experiment-with-bun branch 2 times, most recently from 5892ef2 to d044bd6 Compare March 6, 2024 11:03
@pftg pftg marked this pull request as ready for review March 6, 2024 13:46
@pftg
Copy link
Contributor Author

pftg commented Mar 6, 2024

@ElMassimo, with the latest bun, it looks like it works. I'm working on the cleanup in a separate PR jetthoughts#2

@pftg
Copy link
Contributor Author

pftg commented Apr 4, 2024

https://github.com/ElMassimo/vite_ruby/actions/runs/8186414098/job/22384757347?pr=392 - it's a new issue that appeared lately, I will check, but I believe I need to rebase

@pftg pftg force-pushed the experiment-with-bun branch 5 times, most recently from 89b2388 to 412a06a Compare April 4, 2024 21:51
@schonert
Copy link

schonert commented Apr 5, 2024

@pftg all green - great job!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants