1089 points · by tuananh · 3y ago · 367 comments
Could the mods change the link to the blog post? It explains better than the github release page
Blog post: https://bun.sh/blog/bun-v1.0
> The transition from CommonJS to ES modules has been slow and full of terrors.
> Bun supports both module systems, all the time. No need to worry about file
> extensions, .js vs .cjs vs .mjs, or including "type": "module" in your
> package.json.
>
> You can even use import and require(), in the same file. It just works.
This is the highlight for me. The Node.js ecosystem is more-or-less completely broken otherwise. This might save it.(I think that the most impressive thing about Bun isn't its performance but the pragmatic, developer-friendly choices that have been consistently made by Jarred.)
1) We patched JavaScriptCore to load ES Modules synchronously when they don't use top-level await. The main tradeoff here is that requiring an ES Module which uses top-level await is unsupported (Bun throws an exception when you try to do this)
2) To support require() inside ES Modules, we add `import.meta.require` and have a transpiler integration to convert calls to module.require() or require() into import.meta.require(). This either loads the file as an ES Module or as a CommonJS module, depending on what the transpiler says it is
3) We rely on certain heuristics to decide whether a script is an ES Module or a CommonJS module. If they use certain sloppy mode or CommonJS-only features, it becomes CommonJS. If they use ESM features or it's somewhat ambiguous, it becomes an ES Module.
Is there an option to require each file to use either CJS or ESM features, but not both? If not, may I suggest adding that option?
All three patches mentioned will lead to modules that work only in bun and not work in node/deno/browsers, further fragmentating the ecosystem.
https://twitter.com/threepointone/status/1698271991927648643
If I want, I can literally run a TS file directly with mixed import/require (not that you would ever) directly, without a package.json, tsconfig, dependencies, etc.
In my experience, it's basically Node, minus all the setup/config/build headaches.
Node's split ecosystem has really hurt the entire language and runtime.
I wrote an extensive post a few weeks ago detailing all the pain that I've dealt with and problems I've run into this year trying to modernize the Redux packages to fully support ESM and CJS:
- https://blog.isquaredsoftware.com/2023/08/esm-modernization-...
I've gotten a lot of feedback from other maintainers saying they've run into similar issues.
Also had a couple podcast discussions following up on that topic:
- https://syntax.fm/show/661/supper-club-shipping-esm-with-mar...
The fact Bun solves that problem is more than enough of a reason for me to give it a try, I'm honestly fucking stoked to try it out, and I never thought I'd have those feelings for yet another JS runtime or build tool. Big thanks to the Bun folks, I'm looking forward to gaining some sanity in my day.
Very rarely run into issues but have gotten around with pnpm patch and meta modifications in the past until projects have fixed issues..
My take is 2023 is the year of the module. The water is fine.
That doesn't paint a great picture.
I don't know about the past 10 years as I haven't tried to use modules for the past 10 years. I've been using them for the past year on new AND existing projects with Vite+React, Vite+Storybook, SWC+Fastify, Rollup and library projects, and etc.
Unless somebody has to work in the past I'm sure what relevance that has on using modules in 2023.
It's also against the guidelines, but again 5k karma...
That said, kinda curious now downvoted into negative for sharing my, extensive, experience creating module type projects.. Hrrmmm.
Agree in sentiment, but I don't think this even applies to the module/import mess. My experience has been that the difficulty is in using different packages that made different choices, and making them interop with your own code. I have still yet to make top-level await work in a Typescript codebase where I need to import nontrivial packages. I don't think you should ever need to worry about the specific way your modules are imported, not in prototyping or in production.
I only know that I perfer writing import over require as those semantics and syntax make more sense to me.
I remember hearing that once from the Python devs...
My stack is usually Fastify with official plugins and a PG client.
Maybe at most, hide the capability behind an execution flag.
The only solution to this problem is to upgrade require work for importing ESM. Once that is implemented ESM will become the natural choice for those publishing libraries. Until that happens library authors are going to continue to use CJS so their libraries are available to everyone.
The let-down from the first two projects not being a drop-in replacement is jarring, now I have to be skeptical of all communications coming from bun.
For context, both projects use osc which requires dgram. I was able to find a feature request tracking ticket from 9 months ago with no communicated plans to implement, but searching for 'dgram' in this announcement page doesn't show anything.
For a quick suggestion - can you explicitly state what modules are not supported by bun 1.0 and put that in the section related to node.js compat?
edit: found the docs on node support - https://bun.sh/docs/runtime/nodejs-apis . Would be nice to link in the release notes.
Cursory glance looks like for modules - 17 implemented - 17 partially implemented - 7 unimplemented
Nevertheless I am super impressed with their speed and exited with the result. Didn't expect this project to grow so quickly to this state, I though it will take them much more time. For comparison, deno was started way earlier and now they are miles behind (personal feeling). I am considering to use it for my pet projects
I just started a new project, writing the back end. I'm new to JS and TS, and I don't want to deal with NPM and a morass of modules at all. Deno, Oak, and MariaDB seem like a pretty tidy combo. I have routes and queries up and working with no experience in writing server-side code since PHP 5.
What makes Bun better?
The repl is about to be added and rewritten completely
Most programs should bind to port 0 and let the OS allocate a free port and then report the resulting port to any future clients.
The question isn't just how many? but also which ones?. Anecdotally, I've been test driving bun for a large application with millions of existing customers. So far, the only issue I've had isn't with bun per se, it's with patch-package not yet supporting the lock file (bun.lockb).
Bun is without question faster than yarn by a wide margin. And I say this as someone who really loves yarn.
The fact is each potential adopter either needs to go through and comb over the compatibility page (not what I would expect with a drop-in replacement); or just try and see if it works, and be surprised later if they run into an unimplemented module because they were operating under an incorrect assumption.
> Note — For a detailed breakdown of Node.js compatibility, check out: bun.sh/nodejs.
The detailed breakdown explicitly states which modules are not supported.
---
[1] Not a drop-in replacement
It seems the note mentioning this feels buried for me under a large banner image, instead of near all the other text about compatibility.
Anyway, glad it is there, hope that their communications design improves in the future as at least a few others got caught with mismanaged expectations.
* can't use AWS SDK v3 because throws an error when parsing a response;
* can't use octokit (or anything that depends on jsonwebtoken, for that matter) because node:crypto is not fully implemented;
* can’t run our tests, because jest.resetAllMocks() is missing
* in another project, bun test failed to even run, complaining about invalid call to shared library So for me the local workflow is “run it with bun, see if it fails, re-run with node if it does”. At least I can always replace npm with it, I guess? Can’t imagine running our services with it just yet. Really excited for the future of the project, because when it works - it really is amazing. But I wouldn’t call it 1.0 if the selling feature is Node compatibility.
This has probably been asked before, but has there been any thoughts about moving community chat to a platform other than Discord? Discord has been brought up many times on HN for its accessibility/privacy/proprietary lock-in concerns that don't seem to be in line with the spirit of open-source. Also see [1].
[1] https://drewdevault.com/2021/12/28/Dont-use-Discord-for-FOSS...
https://news.ycombinator.com/item?id=35970869
And in the comments of the bun 0.8 announcement, the same question generates very little interest and some well every other project uses it, so...:
> Choosing proprietary tools and services for your free software project ultimately sends a message to downstream developers and users of your project that freedom of all users—developers included—is not a priority.
— Matt Lee
Discord is just an added communication channel, mostly for the community.
Relevant discussions happen on GH.
I am part of numerous programming discords and I just see no issue with them being on discord, again, starting from the fact being there is far from being a requirement for anything really.
> What I can tell you is that, to my surprise, Discord’s accessibility has apparently improved in recent years, and more blind people are using it now. One of my blind friends told me that most Discord functionality is very accessible and several blind communities are using it. He also told me about a group of young blind programmers who are using Discord to discuss the development of a new open-source screen reader to replace the current Orca screen reader for GNOME
Discord is honestly a great place for FOSS to house their communications. I find all of the articles claims very haphazard:
> When you choose Discord, you are legitimizing their platform and divesting from FOSS platforms
It is legit? It's free? It has loads of compelling features, is very accessible, and - most importantly... Also, choosing Discord does not take value away from FOSS communication platforms.
> Use IRC
It isn't IRC which is very inaccessible to lots of people new to computers and software in general.
Yes, but this ignores the others issues the post brings up: Users who cannot afford new enough hardware to make the resource-intensive client pleasant to use are also left by the wayside.
Or: Discord also declines service to users in countries under US sanctions, such as Iran.
> Discord is honestly a great place for FOSS to house their communications ... Discord does not take value away from FOSS communication platforms.
The blog's author, and others such as myself disagree. Discord chats are not indexible by search engines, so solutions are harder to find. You need a Discord account, and you need to join the channel to even see chat and use the search feature. Discord is proprietary and non-extensible because of it. Lastly, Discord is also profit-motivated, so they can shut things down or add limitations because they need to maintain a profit, and there would be nothing we can do about it. "Enshittification" as HN users love to say, is practically inevitable.
> It isn't IRC which is very inaccessible to lots of people new to computers and software in general.
Which client are you speaking of? :) The beauty of IRC, Matrix, XMPP, etc is that you have the choice and freedom (without being legally threatened by Discord Inc.) to build your own client.
Instead of bashing library authors that have already so much to think, why don't you propose a discord replacement and pay for it, while providing the same ease of use for the users and the same features from channels, threads, third party apps/plugins, video conferencing, etc?
Wait… people can’t run web browsers?
it does though. it's the same vicious cycle that allowed microsoft to gain control of the OS market: developers write programs for windows (because that's where the users are) and users run windows (because that's where the programs run). the more people agree to use discord, the more it becomes "the place where the <x> community is", the harder it becomes for any community to not use it.
9/10 discord users don't understand or care about this at all. which is why it's of utmost importance that developers - especially open source developers, presumably developing open source software for a reason - encourage discussion on other platforms.
There's some room for debate about offering Discord as a bridged option. But having the official community chat only on Discord? How is there even a question?
Both are proprietary websites owned by for-profit companies. Both require you to create an account in order to participate in discussion.
Free as in gratis, sure. But as in libre? No, it’s definitely proprietary & it’s free because users are the product (data collected and upselling Nitro); not every user wants to give up their privacy freedoms to participate. Discord’s not federated so users will be required to create an account & agree to the ToS & CoC of Discord, not the community running it. Discord has also been hostile towards folks trying to make alternative clients to meet usability needs & certain kind of bots.
Without IRCV3 & bouncer it would be a difficult/unexpected experience for a new user. Luckily IRC isn’t the only libre option. If you want to keep the system requirements low XMPP MUCs are good & allow federation. If you want newer bells & whistles at the cost of system requirements federated Matrix can be considered (tho centralization concerns around Matrix.org having the most users, most used server, most used client, & controls the spec). There are bridges between all of these that you can choose as many or as few as meets the community needs such as a community-hosted XMPP main server in a neutral country with bridges to IRC & Discord.
Could you link to the program they are working on? Nothing appears when searching for "orca screen reader for gnome replacement."
Creating a channel on Matrix.org is free.
Libera.Chat & OFTC offer free IRC for open source—& can depending on the community be a welcome bridged platform for any alternative as IRC requires the least resources to run (tho if you need rooms with encryption, that won’t be an option).
I see bun's licensing is MIT, and that is fantastic. So that does give me some hope it won't die should the business go under. I hope the business succeeds, but I'm curious should I adopt bun, what might the upsell be down the road.
Oven will provide incredibly fast serverless hosting & continuous integration for backend & frontend JavaScript apps — and it will be powered by Bun.
It will support popular frontend frameworks like Next.js, Vite, SvelteKit, SolidStart and many more — along with backend frameworks like Express, Fastify, NestJS and more.
The plan is to run our own servers on the edge in datacenters around the world. Oven will leverage end-to-end integration of the entire JavaScript stack (down to the hardware) to make new things possible.
Trying to keep up with one guy's side project caused me so much pain that I moved everything to Rollup and never looked back.
VC funded and random side project clearly have different concerns, but the ultimate risk with either is "if the creator can't support me, then what"
The tooling situation around JavaScript is certainly my biggest pain point around it and turns a really very capable and pleasant language (ES6 + TS) into a complete chore. Here’s hoping that Bun can deliver.
It has to be a similar feeling as going from CMake to Cargo.
It reminds me as a runtime version of Rome tools, which had a similar goal (replace a bunch of software with a single faster one). It went under and has [transition to OSS under a new team](https://biomejs.dev/blog/annoucing-biome). I hope you find more success than they did! It's certainly a hard problem to solve.
Any seasoned users with time spent on both?
It seems Bun’s major selling point is performance. I can’t say I’ve really run into massive performance concerns with Node. It isn’t earth shatteringly fast but I’m way more likely to run into IO constraints than Node speed issues.
Deno’s major selling point was that it was Node Done Right in many ways: better packaging, ES6 all the way, etc. (a pitch I was sold on!) but it seems they gave up trying to create a new ecosystem and instead are adding Node compatibility.
Alongside all of this I'm encouraged by a number of recent Node improvements like having its own test runner and built in .env support. So I’m struggling to see good reason to use either Bun or Deno. Even if I were to switch I'd need to make sure I have a concrete path back to Node should the new generation tool become unviable.
This is extremely compelling for frontend DX.
The bundler stuff is certainly more compelling though the page doesn't specify what makes it better than esbuild except that it comes built-in... but that's where, for me, VC concerns raise their head. If I go all in on Bun bundler, what happens if the company switches their priority towards monetization and neglects the bundler? I'm going to have to unroll all the configuration work I will have done and go back to an external bundling library. And it's still not entirely clear what I gain!
Not sure how they plan on monetizing.
All valid ideas. But the involvement of VCs makes me wonder what kind of scale they're going to be expected to achieve and what will happen if they don't.
Bun is bundling everything and making it really fast, while also striving to maintain as much compatibility as possible with Node. It doesn't throw away the existing ecosystem.
Deno took on too much of an adversarial perspective towards the Node ecosystem and now they're working towards re-adding support.
So in terms of a successor, I'd say the only option is Bun because it's still trying to maintain compatibility with Node while innovating with new features.
Why Bun uses WebKit/JSC was described here:
> One of the reasons why Bun bet on JavaScriptCore instead of embracing the server-side V8 monoculture is because JavaScriptCore and WebKit/Safari are strongly tied together. This means that Bun can often use implementations of Web APIs from WebKit/Safari directly, without having to reimplement them. This is a great example of that.
via https://bun.sh/blog/bun-v0.7.1#messageport-messagechannel-ar...
For new, from-scratch projects done by someone who doesn't know Node anyway, why not use Deno? I just started writing the server side of a mobile app with it, and I didn't even know JS, TS, or have any experience with routing frameworks. I had server-side queries working in a matter of days, and I don't claim to be fast at all.
The issues cited in the Bun PR, like the morass of modules and related performance problems, don't seem to exist in plain Deno. Or am I missing something? I don't anticipate ever integrating anything from NPM, so I'm actually disappointed (but understanding of the motivation) to see Deno hedge on the "fresh start" idea.
I have never used Node and am creating a new project from scratch, so I don't know how worried to be about your commentary.
These days, if you're authoring from scratch, just write idiomatic TS in ESM, and you'll be fine. Even if targeting only Node, prefer to use Web standards (e.g., fetch, Request/Response, WebCrypto, Web Streams, URL, AbortController) as Node is migrating in that direction, and standard-compliant code will give you optionality in runtimes (Bun/Node/Workers).
1. Missing `node:http2`
2. Missing `node:test`, so it's more difficult to execute the same test files within Bun as we do via Node. I wrote a custom Bun loader to mock parts of `node:test`.
3. Vite and ESLint do not work.
4. Still occasionally segfaults, and it's difficult to find out why/where.
5. Surprisingly, some code runs slower in Bun than in Node. For example, generating JWE with symmetric encryption. But this might be WebCrypto vs OpenSSL.
6. Subtle differences between WebKit and V8 (e.g., how they handle dates).I did raise issues with repros for it only wasn't able to try to fix the issues myself. Building Bun is not working for me
Edit: sounds like this is changing. Thanks for the correction!
Bun aims to be a better replacement to Node. There's less to consider so it's just a matter of if it's compatible enough and faster / better to warrant the switch. A lot easier to swallow.
I know very little about JS and TS and "modules," but from a newcomer that's how it all looks. I'm happy to have any further insight!
But, the command `bun install` supports NPM and custom registries, as well as Git and .tgz URLs.
While Node's performance story keeps improving release over release [1].
The specific bug ended up not being in fetch() body streaming, but in our JavaScriptCore binding for getting a property from an object that may not have defined the property. Not all of our code was checking that the value was an object (only that it was a JSCell, which usually is an object, but things like symbols and BigInt are not JSObject)
Thread from yesterday: https://news.ycombinator.com/item?id=37424724
Extra hint - you may provide text snippet for Ansible playbook/taskset with proper sha256/similar checksumming for installing via "Download from Internet, not from your distro repos", the same for Puppet (which gonna be bit more complicated).
Will ease up a bit system's administrators work - SAX - system administrator experience, if you wanna name it that way :)
I'm confused cause this guide on the official site showcases how to use Bun + Vite.js to build a TypeScript React app. [1]
There is also this issue on their Github. [2]
Can Vite.js be used to handle more complicated scenarios / advanced use cases that Bun doesn't handle? My use of Vite.js is pretty basic (start & build with the default TS+React config) so maybe I'm missing something here.
--
Granted I have no experience with bun yet, my take on it is that you can leverage bun for running the local dev server (instead of node), leverage bun for bundling (instead of esbuild or tsc or rollup or an amalgamation of them), and leverage bun for transpiring instead of Babel and typescript.
What vite provides is an easy to configure setup for developing frontend applications with a nice DevX when working locally.
And most of the new meta frameworks(nuxt,sveltekit,astro,solidstart,qwik) runs on vite so that might pave a path for adoption.
Realistically how much of a problem is this likely to be?
Seriously, I think this question is worth asking. Why was Zig chosen as the language when it’s not even stable, and what implications does this have for the long term viability of the project (besides the fact that its _fast_)? Zig’s head guy isn’t even sure when Zig will hit v.1.0, and Bun’s head guy hasn’t really responded either AFAIK.
If Zig dies tomorrow, bun could probably continue using it as-is, perhaps after fixing the bugs they encounter. It's "the API and language spec isn't complete yet" unstable, not "we haven't implemented floating point operations yet" unstable. So far, only the allocalypse has caused major grief in terms of language changes, as far as I know.
Demonstrably by this 1.0 bun release it seems safe to say it ended up being a fine decision, no?
That's what I don't like about these modern languages. You have to be in the community and keep up with the latest releases in order to use the language. I just want something that's stable. I don't want to keep relearning everything.
It is a very young language with momentum and a foundation behind it. I'm not aware of any pre 1.0 stability guarantees.
In fact it is generally recommended to use the nightly release (see: https://ziglang.org/learn/getting-started/) because they are moving quickly.
Definitely seems to be in a early adopters and tinkerers phase.
I've been following the progress of bun since your initial announcement and today I decided to give it a try, just to play around.
Haven't done much with it, but even for the 5 min I played with it I'm kind of impressed so far.
- Superquick install PLUS did not require root (like many other installs)
- It identified I was using fish shell and added to path (nice!)
- I ran a very quick bench on "npm install" vs "bun install" on one of the projects I have, and the performance is amazing. 50seconds vs 4.5 seconds on the first install. Moreover re-executing "bun install" takes 122ms on my machine. Removing node_modules and re-executing it takes 769ms (because of course, it uses a local cache elsewhere, but still). Amazing.
I'll probably continue exploring tomorrow and see whether it is able to run the rest of the backend/frontend or whether it gives me a hard time. I've seen there are certain things that are not 100% compatible with node yet, but since the initial impressions are great I'll explore further.
BTW A code formatter and a linter would be a great addition to bun.
I know there is this ticket: https://github.com/oven-sh/bun/discussions/712
But one of the advantages of integrating both things in bun is that it makes it the perfect standard tool to be used inside of a team. So no extra installations from other projects, no extra mental burden of what to use, etc... bun would be the perfect dev companion with both ;)
Probably a linter is a different beast (and not sure you or the rest of people working in bun want to get in there... probably not important right now), but a formatter seems doable and it does add a lot of value from my point of view. Given that bun already runs, installs, tests and bundles, to the very least _formatting_ seems like a natural addition to the family. To me a formatter is part of the standard toolset for developers nowadays.
Once again, thanks a lot for the effort to you and the rest of the people contributing to the project!
(edit: re-formatted my comment :p)
I haven't thought twice about it. Frankly, I forgot that bun has been happily running behind the scenes for me. I highly recommend anyone using NodeJS to give it a go.
And Bun is going to improve that?
Sure, the instability of Zig may increase the maintenance costs for Jarred, to use updated versions of Zig. But this has no effect on the features that Bun provides. The risk that a change to Zig would be so consequential that they would actually prevent Jarred from continuing to work on Bun, or would otherwise force Jarred to fork Zig, that risk is so low as to be inconsequential.
(disclaimer: not associated with either bun or zig, the above are pure opinions)
With that said, it is probably fine to use for most ordinary apps, but I wouldn't yet build a bank infrastructure on top for example.
But from anecdotes, I have the impression people still run into bugs and missing functionality semi-commonly. I'm sure it works great for small/personal projects, but I've been hesitant to recommend it for production use at my workplace because of this impression
So my question is: how feature-complete/stable/secure is it right now, what does the v1.0 label say about that, and what are the long-term plans/prioritization/guarantees around this area?
ESM can use top-level await and CJS can't. So this can't possibly work, right?
// x.mjs
export const x = await 'x';
// y.cjs
console.log(require('./x.mjs').x);
And, indeed, it doesn't work in Bun. When I `bun y.cjs` it gives me this error message: TypeError: require() async module "/tmp/x.mjs" is unsupported. use "await import()" instead.
… but using "await import()" instead is exactly what I was trying to avoid! I can use "await import()" in Node, too.But it looks like it does work in Bun if I drop the `await` from y.mjs. So, is it just transpiling ESM to CJS, and failing out if the ESM uses top-level await?
EDIT: I see the documentation page https://bun.sh/docs/runtime/modules has a "low-level details" section, explaining how import(CJS) works (by transpiling CJS to ESM), but it doesn't say anything there about how require(ESM) works, which is unfortunate, because that's by far the most interesting part! I've filed a doc bug on this. https://github.com/oven-sh/bun/issues/4601
I love it, it super simplifies project and for minimalists it's perfect.
TSC is simultaneously the most valuable and the most flaky part of your typical JS project setup. That’s the main part I’d be interested in replacing with a different tool.
It has to run TSC (or expect somebody else to run it) in order to typecheck, though, right?
It hardly mentions anything until the very bottom on what's changed to reach v1, the github release page on the other hand clearly outlines it.
Personally found the blog post to read like documentation rather than a release announcement.
[0] - https://oven.sh/
However, if I recall correctly, the early days of node.js was mostly funded by Joyent. It took time and some major conflicts for Node to be controlled by a foundation.
Any plans for other interesting experimental features (like macros)?
I don't know how much this is still a problem, but a few years ago one area where I used to experience a bit of pain was that package.json scripts would get pretty unwieldy and supporting windows required using third-party tools. Have you consider experimenting a bit with the scripts or are you happy with the state of that feature?
"Unlike Node.js and other runtimes that are built using Google's V8 engine, Bun is built using Apple's WebKit engine. WebKit is the engine that powers Safari and is used by billions of devices every day. It's fast, efficient, and has been battle-tested for decades."
That's really interesting, does WebKit do less JITing or something to be faster for startup?
I don't know that much so I have some questions, sorry if they're already answered. (share link if any if its possible)
Do you plan to support as much as possible the Node.js API (99%) or most features and make your own API for lets say Clustering module and such ?
Speaking of Cluster module, do you want to recreate Node.js Cluster module, or do you plan to create your own way for multi-processing using Bun in a more performant way ?
I've seen Deno putting a lot of effort into the platform around their runtime, making deploying Deno app easy, is that your goal too ?
I've seen that you use Zig instead of C++, what do you like the most about Zig while working on Bun ?
In anyway, I hope the project will make the JSRuntime world better, its promising.
I’ve been loosely following the progress of Bun for awhile, but I haven’t actually tried it. The blog post you linked does make it sound very intriguing.
[0]: http://remix.run/
It's probably fine for new projects though.
It may not matter to you personally, but if it is used in a project with developers working on different platforms, it is going to present some hurdles.
I use all 3 OSes and this superiority complex is tiresome
what do you base this ad hominem on?
If you try to convince your company to deploy servers on a windows environment instead of linux, you better have a really extraodinary reason, that's just a fact. If Windows is any good it's because of the software ran on it (games and related drivers?), despite the OS
In addition, your "bun-linux-x64.zip" doesn't work on CentOS7 due to glibc compatibility. Would be good to provide a more portable binary.
I am amazed and not at all amazed that GCC has never got a --compatible-with-old-linux flag.
To be fair MacOS doesn't really either, but people tend not to run 9 year old versions of MacOS.
> ...
> pnpm
pnpm's flagship feature is global deduplication of packages, so sadly bun's package manager doesn't seem to be a replacement. Is there any plan or intention to support pnpm-like disk saving? (I suppose not having to esbuild etc. everywhere already helps.)
That said, I'm very impressed with the speed of `bun add` with already cached packages. Literally instant.
According to that, the speed benefits will probably not be as noticeable in windows.
That, coupled with the fact that bun installs twice as fast when no packages are cached (634ms compared to 1.3s) and 100x as fast when all packages are cached (6ms to 639ms), I think it's fair to say that bun can replace pnpm.
Here's the package.json I tried:
{ "dependencies": { "express": "^4.18.2" } }%I know it’s possible to get it to work, but I didn’t have time to fiddle all the bits.
If Bun made this easier, I’d switch from pnpm immediately.
I would have trusted it in production before 1.0 and moreso now. Unfortunately, I cannot use it for most projects right now. I package my applications with Nix for deployment and Nix and bundling JS dependencies is mostly not a great story right now. buildNpmPackage works just fine most of the time, but requires that I use npm to bundle my dependencies.
Of course, this is no fault of Bun whatsover. Bun can emit a yarn.lock that is compatible with Yarn 1. If it could also emit a package-lock.json that might unblock my use case. The more ideal solution would be to build an equivalent of buildNpmPackage that deals directly with Bun, but I'm afraid the effort would not be worth it right now.
The places where WebKit lags behind aren't the places Bun really cares about. I'm honestly quite glad they add some diversity to Javascript land.
I recall reading a comment that JavaScriptCore was chosen because of performance. I believe JSC is quicker to start up, and I wouldn't be surprised if it wasn't faster at executing the type of code Bun executes as well.
% cd /tmp
% mkdir app
% cd app
% time bun install react
bun add v0.6.1 (78229da7)
installed react@18.2.0
3 packages installed [20.00ms]
bun install react 0.01s user 0.01s system 50% cpu 0.041 total
% find node_modules | wc -l
41 $ cd /tmp/
$ mkdir app1 && cd app1
$ time bun install react
bun add v1.0.0 (822a00c4)
installed react@18.2.0
3 packages installed [431.00ms]
real 0m0.436s
user 0m0.031s
sys 0m0.052s
$ cd ..
$ mkdir app2 && cd app2
$ time bun install react
bun add v1.0.0 (822a00c4)
installed react@18.2.0
3 packages installed [6.00ms]
real 0m0.010s
user 0m0.006s
sys 0m0.005s
Though even 431ms is obviously amazing!Guides: https://bun.sh/guides
The docs say that Bun uses clonesfiles / hardlinks (yay). But it also states that clonefiles don't benefit space saving:
> This benefit does not extend to macOS, which uses clonefile for performance reasons
As far as I know, clonefiles are COW, which should not take any space except the extra inode.
I am still absolutely amazed at how much more performant websockets throughput in bun vs node.
Congrats on 1.0!
With non trivial I mean an application using a lot of Nest.js features and libraries like TypeORM, Swagger-UI.
Bun has seriously been a god send. I am so happy that we can finally do top level awaits and it allowed us to delete a lot of hacky code that we had in place just to make node and all the build dependencies happy.
ERROR Cannot build module „nuxt“ {}
Feel free to DM me if I can be helpful.
I've tried this release on one of my projects and encountered some errors, where is the best place to send reports about compatibility issues?
As a library author, how convenient is it to have one suite of tests that can execute in both Bun and Node.js? (E.g. with jest?)
Either way still excited to check it out
what type of project can I use Bun on without regretting it (due to unforeseen bugs, incompatibilities, etc)?
Performance comparisons to Go/Java on the backend would be insightful. Would be interesting to see how close the gap is.
There's a slightly similar case high on the frontpage right now: https://news.ycombinator.com/item?id=37434918. The thing isn't released yet but the appetite to discuss it is strong.
====
Doc's install section for Linux missing DEB/RPM
I'll have to see how it goes on slower machines, ARM, etc.
Thanks!
This makes for a pretty awesome combination considering bun's system calls and sqlite support.