-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Add a Bun template #7399
base: main
Are you sure you want to change the base?
Add a Bun template #7399
Conversation
|
FYI: Not only is @jacob-ebey a contributor, but he also works for Remix/Shopify. He implemented the |
I tried running jacob's setup but |
Thanks for looking at this PR @BryceBlankinship !
I have been researching this now and confirm a node process does start. I will get back about why that is if/when I find out why. Out of curiosity, which docs are you referring to that say 'It still runs a node process'? What is |
Yes, I was paraphrasing that guide, thanks for checking it out! |
I think I found it. It comes from when calling the |
Creating a dedicated package does indeed seem necessary. I started a proposal discussion about it here and might put this PR on ice until that is resolved. Thanks a million for swift reviews and running the fairly obvious test of 'is it actually not running on node' 🤣 |
@hjonasson you can force the dev server to use Bun's runtime instead of Node.js by using the bun run --bun dev However, it currently fails because the dev server attempts to use |
Wow! Thanks @trojanowski! |
Coming in 1.0.3 - can try it now via |
I upgraded to Bun canary and ran Could not reach Remix dev server at http:https://localhost:3001/ping
22 | * @param {string} type
23 | */
24 | constructor(message, type) {
25 | super(message);
26 | // Hide custom error implementation details from end-users
27 | Error.captureStackTrace(this, this.constructor);
^
error: request to http:https://localhost:3001/ping failed, reason: Can only call URLSearchParams.toJSON on instances of URLSearchParams
code: "undefined"
at new FetchBaseError (PATH/node_modules/@remix-run/web-fetch/dist/lib.node.cjs:27:2)
at new FetchError (PATH/node_modules/@remix-run/web-fetch/dist/lib.node.cjs:65:2)
at PATH/node_modules/@remix-run/web-fetch/dist/lib.node.cjs:1801:10
at _final (node:http:840:16)
at callFinal (node:stream:2763:44)
at prefinish (node:stream:2786:44)
at finishMaybe (node:stream:2793:48)
at node:stream:2726:150
at onend (node:stream:2079:40)
at endReadableNT (node:stream:2387:52)
at processTicksAndRejections (:55:76) Note I'm using v1.19 and not v2 but I don't think that changed. Good thing is that I didn't get the |
@sergiodxa I'm seeing the same |
@ryanstout I haven't tried again, but note that that only happens when running the It's also possible that if you use the Remix's Vite plugin it could work with Bun too, but that depends if Vite runs on Bun. |
Huh, I made dev mode work! 🎉 Although, it works only for default remix + vite mode. The only change which were needed is to remove It turned out it's a lot harder to make a proper script to use Bun's HTTP server with Vite as dev server. Here is a partially working try — https://gist.github.com/DimitryDushkin/dd2c47c987ac569a818d355863440382 Run it via SSR in this |
You should look at how Hono Vite dev server works. https://github.com/honojs/vite-plugins/tree/main/packages/dev-server |
👋 Hi there,
I had spent some time trying to run Remix on Bun. Then I found that it had already been done here by @jacob-ebey (who is already on the list of contributors, otherwise I would have added him there along with this PR). I checked out the repo to see if it worked with the new stable version of Bun and it does.
If this PR is accepted I will update the Bun docs regarding Remix (here). I am not sure that the comment there about Remix relying on Node APIs that Bun doesn't implement yet is correct. One of the selling points of Remix is that it doesn't rely on Node. Please correct me if I am missing something. As far as my research into it goes that comes from this discussion which looks like they are calling
node
with Bun 🤷 by accident.If this better belongs as a package,
@remix-run/bun
for example please let me know and I will adjust.Note that I am merging to
main
as the contribution docs here suggest "some templates" should go tomain
.I would love to add some tests using the Bun test runner but am hesitant as it sounds like a lot of work adding it to CI as well. All pointers there are appreciated.