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

feat: Bun compatibility #164

Merged
merged 2 commits into from
Jul 7, 2022
Merged

feat: Bun compatibility #164

merged 2 commits into from
Jul 7, 2022

Conversation

tlgimenes
Copy link
Contributor

@tlgimenes tlgimenes commented Jul 7, 2022

What's the purpose of this pull request?

This PR makes this starter compatible with the new JS runtime called bun

Bun is the new JS runtime compatible with both Node.JS and Web APIs. It promises to drastically improve performance for both runtime and bundling/installing dependencies. Below, I've gathered some metrics on the differences between our current stack (node + yarn) vs bun. These are values for 95% confidence interval

runtime install node_modules build (fresh) build (cache)
yarn1.22 + node18 40.5186s ±1.711 800M 59.7888s ±3.89 18.0767s ±2.471
bun0.1.1 4.3079s ±0.551 709M 36.7s ±2.618 11.9764s ±0.535

How does it work?

bun is not yet a drop in replacement for node. You can notice by the dependencies I've had to remove to make this starter compatible with bun. Hopefully, these dependencies were not need by either Next.JS or Storybook and I think it's safe to merge this PR and remove these dependencies anyways.

I've had issues with the gatsby.store starter, where the sharp module would not be installed. Maybe this will be fixed in the future and we will be able to use bun in there as well.

Vercel is preparing to provide the bun runtime and I guess we should prepare ourselves too by adding early support on FastStore Cloud platform via a flag. I think we would have massive gains on this regard.

How to test it?

Download this starter and run bun install && bun run develop. You should see the starter as usual.

References

@vercel
Copy link

vercel bot commented Jul 7, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
nextjs-store-storybook ✅ Ready (Inspect) Visit Preview Jul 7, 2022 at 3:09PM (UTC)

@tlgimenes tlgimenes requested a review from a team July 7, 2022 14:25
@vtex-sites
Copy link

vtex-sites bot commented Jul 7, 2022

Preview is ready

This pull request generated a Preview

👀   Preview: https://sfj-729b166--nextjs.preview.vtex.app
🔬   Go deeper by inspecting the Build Logs
📝   based on commit 729b166

@tlgimenes tlgimenes marked this pull request as ready for review July 7, 2022 15:05
Copy link
Member

@emersonlaurentino emersonlaurentino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👢

@vercel vercel bot temporarily deployed to Preview July 7, 2022 15:09 Inactive
@vtex-sites
Copy link

vtex-sites bot commented Jul 7, 2022

Lighthouse Reports

Here are the Lighthouse reports of this Pull Request

📝 Based on commit 729b166

Lighthouse Report by page
📎   /
📎   /apple-magic-mouse/p
📎   /office

@tlgimenes tlgimenes merged commit 729b166 into main Jul 7, 2022
@tlgimenes tlgimenes deleted the feat/bun branch July 7, 2022 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants