Bun v1.0.6 fixes 3 bugs (addressing 85 ๐ reactions), including a regression impacting Docker usage with Bun and implements support for the overrides
& resolutions
fields in package.json
.
Bun is an incredibly fast JavaScript runtime, bundler, transpiler, and package manager โ all in one. In case you missed it, here are some of the recent changes to Bun:
v1.0.0
- First stable release!v1.0.1
- Named imports for .json and .toml files, fixes tobun install
,node:path
, andBuffer
v1.0.2
- Make--watch
faster and lots of bug fixesv1.0.3
-emitDecoratorMetadata
and Nest.js support, fixes for private registries and morev1.0.4
-server.requestIP
, virtual modules in runtime plugins, and morev1.0.5
- Fixed memory leak withfetch()
,KeyObject
support innode:crypto
module,expect().toEqualIgnoringWhitespace
inbun:test
, and more
To install Bun:
curl -fsSL https://bun.sh/install | bash
npm install -g bun
brew tap oven-sh/bun
brew install bun
docker pull oven/bun
docker run --rm --init --ulimit memlock=-1:-1 oven/bun
To upgrade Bun:
bun upgrade
Docker "abort" regression bugfix
In Bun v1.0.5 (released earlier today), we introduced a regression that caused Bun to abort()
at start when used in Docker on some systems that lack support for the v1 version of cgroups. This has been fixed in Bun v1.0.6.
overrides
& resolutions
support
This release implements support for "overrides"
in package.json. "overrides"
lets you override the version of a dependency to a specific package version. This is useful when you want to force a dependency to use a specific version, or point to a different package
One usecase is to ensure only a single version of a package is used in a project. For example:
{
"dependencies": {
"react": "^17.0.0",
"react-dom": "^17.0.0",
"some-other-package": "^1.0.0"
},
"overrides": {
"react": "17.0.0",
"react-dom": "17.0.0"
}
}
Now, even if "some-other-package"
specifies "react-dom": "^16.0.0"
, Bun will use "react-dom": "17.0.0"
instead.
In Bun's implementation, only one level deep is supported, meaning the version you set applies to every package in the dependency tree. In the future, we may implement support for nested overrides.
Yarn implements a similar field called "resolutions"
, which is also supported in Bun:
{
"dependencies": {
"something-depending-on-typescript": "^1.0.0"
},
"resolutions": {
"**/typescript": "5.2.2"
}
}
We want Bun to be easily adoptable, and that philosophy is why we decided to support both "overrides"
and "resolutions"
.
Another use case of this is to assign completely different specifiers. This makes it possible to use a patched version of a dependency, or replace it with something completely different.
{
"overrides": {
// override any package that uses "react-native" with "react-native-web"
"react-native": "npm:react-native-web@0.19.9",
// create a symlink to the given directory instead of installing from npm
"lodash": "file:./not-lodash",
// or a tarball (can be a url or local path)
"hello": "file:./some-package.tgz"
}
}
These specifiers work the same way as the ones in "dependencies"
, but forces all dependencies to use the version you specified.
Thanks to @paperdave for implementing this feature!
Bug impacting pre-release tags with latest version
A bug causing Bun to choose an incorrect version when using a pre-release tag (e.g. -0
) that was marked as the latest version has been fixed, thanks to @dylan-conway.
To view the full list of changes, check out the Bun changelog.