Bun is an all-in-one toolkit for JavaScript and TypeScript apps. It ships as a single executable called bun
.
At its core is the Bun runtime, a fast JavaScript runtime designed as a drop-in replacement for Node.js. It's written in Zig and powered by JavaScriptCore under the hood, dramatically reducing startup times and memory usage.
bun run index.tsx # TS and JSX supported out-of-the-box
The bun
command-line tool also implements a test runner, script runner, and Node.js-compatible package manager. Instead of 1,000 node_modules for development, you only need bun
. Bun's built-in tools are significantly faster than existing options and usable in existing Node.js projects with little to no changes.
bun test # run tests
bun run start # run the `start` script in `package.json`
bun install <pkg> # install a package
bunx cowsay 'Hello, world!' # execute a package
Bun supports Linux (x64 & arm64), macOS (x64 & Apple Silicon) and Windows (x64).
Linux users — Kernel version 5.6 or higher is strongly recommended, but the minimum is 5.1.
# with install script (recommended)
curl -fsSL https://bun.sh/install | bash
# on windows
powershell -c "irm bun.sh/install.ps1 | iex"
# with npm
npm install -g bun
# with Homebrew
brew tap oven-sh/bun
brew install bun
# with Docker
docker pull oven/bun
docker run --rm --init --ulimit memlock=-1:-1 oven/bun
To upgrade to the latest version of Bun, run:
bun upgrade
Bun automatically releases a canary build on every commit to main
. To upgrade to the latest canary build, run:
bun upgrade --canary
-
Intro
-
Templating
-
Runtime
-
Package manager
-
Bundler
-
Test runner
-
Package runner
-
API
-
Project
-
Binary
- Convert a Blob to a DataView
- Convert a Blob to a ReadableStream
- Convert a Blob to a string
- Convert a Blob to a Uint8Array
- Convert a Blob to an ArrayBuffer
- Convert a Buffer to a blob
- Convert a Buffer to a ReadableStream
- Convert a Buffer to a string
- Convert a Buffer to a Uint8Array
- Convert a Buffer to an ArrayBuffer
- Convert a DataView to a string
- Convert a Uint8Array to a Blob
- Convert a Uint8Array to a Buffer
- Convert a Uint8Array to a DataView
- Convert a Uint8Array to a ReadableStream
- Convert a Uint8Array to a string
- Convert a Uint8Array to an ArrayBuffer
- Convert an ArrayBuffer to a Blob
- Convert an ArrayBuffer to a Buffer
- Convert an ArrayBuffer to a string
- Convert an ArrayBuffer to a Uint8Array
- Convert an ArrayBuffer to an array of numbers
-
Ecosystem
- Build a frontend using Vite and Bun
- Build an app with Astro and Bun
- Build an app with Next.js and Bun
- Build an app with Nuxt and Bun
- Build an app with Qwik and Bun
- Build an app with Remix and Bun
- Build an app with SolidStart and Bun
- Build an app with SvelteKit and Bun
- Build an HTTP server using Elysia and Bun
- Build an HTTP server using Express and Bun
- Build an HTTP server using Hono and Bun
- Build an HTTP server using StricJS and Bun
- Containerize a Bun application with Docker
- Create a Discord bot
- Deploy a Bun application on Render
- Read and write data to MongoDB using Mongoose and Bun
- Run Bun as a daemon with PM2
- Run Bun as a daemon with systemd
- Server-side render (SSR) a React component
- Use Drizzle ORM with Bun
- Use EdgeDB with Bun
- Use Neon's Serverless Postgres with Bun
- Use Prisma with Bun
- Use React and JSX
- Add Sentry to a Bun app
-
HTTP
- Common HTTP server usage
- Configure TLS on an HTTP server
- fetch with unix domain sockets in Bun
- Hot reload an HTTP server
- Proxy HTTP requests using fetch()
- Send an HTTP request using fetch
- Start a cluster of HTTP servers
- Stream a file as an HTTP Response
- Streaming HTTP Server with Async Iterators
- Streaming HTTP Server with Node.js Streams
- Upload files via HTTP using FormData
- Write a simple HTTP server
-
Install
- Add a dependency
- Add a development dependency
- Add a Git dependency
- Add a peer dependency
- Add a tarball dependency
- Add a trusted dependency
- Add an optional dependency
- Configure a private registry for an organization scope with bun install
- Configure git to diff Bun's lockb lockfile
- Configuring a monorepo using workspaces
- Generate a human-readable lockfile
- Install a package under a different name
- Install dependencies with Bun in GitHub Actions
- Override the default npm registry for bun install
- Using bun install with an Azure Artifacts npm registry
- Using bun install with Artifactory
-
Process
-
Read file
-
Runtime
- Debugging Bun with the VS Code extension
- Debugging Bun with the web debugger
- Define and replace static globals & constants
- Import a JSON file
- Import a TOML file
- Import HTML file as text
- Install and run Bun in GitHub Actions
- Install TypeScript declarations for Bun
- Re-map import paths
- Read environment variables
- Run a Shell Command
- Set a time zone in Bun
- Set environment variables
-
Streams
- Convert a Node.js Readable to a Blob
- Convert a Node.js Readable to a string
- Convert a Node.js Readable to an ArrayBuffer
- Convert a Node.js Readable to JSON
- Convert a ReadableStream to a Blob
- Convert a ReadableStream to a Buffer
- Convert a ReadableStream to a string
- Convert a ReadableStream to a Uint8Array
- Convert a ReadableStream to an array of chunks
- Convert a ReadableStream to an ArrayBuffer
- Convert a ReadableStream to JSON
-
Test
- Bail early with the Bun test runner
- Generate code coverage reports with the Bun test runner
- Mark a test as a "todo" with the Bun test runner
- Migrate from Jest to Bun's test runner
- Mock functions in
bun test
- Re-run tests multiple times with the Bun test runner
- Run tests in watch mode with Bun
- Run your tests with the Bun test runner
- Set a code coverage threshold with the Bun test runner
- Set a per-test timeout with the Bun test runner
- Set the system time in Bun's test runner
- Skip tests with the Bun test runner
- Spy on methods in
bun test
- Update snapshots in
bun test
- Use snapshot testing in
bun test
- Write browser DOM tests with Bun and happy-dom
-
Util
- Check if the current file is the entrypoint
- Check if two objects are deeply equal
- Compress and decompress data with DEFLATE
- Compress and decompress data with gzip
- Convert a file URL to an absolute path
- Convert an absolute path to a file URL
- Detect when code is executed with Bun
- Encode and decode base64 strings
- Escape an HTML string
- Get the absolute path of the current file
- Get the absolute path to the current entrypoint
- Get the current Bun version
- Get the directory of the current file
- Get the file name of the current file
- Get the path to an executable bin file
- Hash a password
- Sleep for a fixed number of milliseconds
-
WebSocket
-
Write file
Refer to the Project > Contributing guide to start contributing to Bun.
Refer to the Project > License page for information about Bun's licensing.
bun's People
Forkers
addy dawkaka styfle vesamet divzoon claeusdev lucacasonato hyp3rflow aaronhuggins wpears aladdinwang alexkuz geminiyellow purefunctor danieltolentino baggiest dbrudner gabssnake therakeshpurohit perjerz logikaljay baedonghee taisho intergalacticspacehighway diegopacheco webreflection summercms cyberflamego shannonrothe nully0x f3n67u icodein hi-sunshine rsp redstrike cxz eyalcohen4 wvanrensselaer kustomzone q930844n dacsang97 eltociear josefaidt youfoundron jsjoeio mustafahasankhan dioveath ghimiremanish swalahamani pybaker xhyrom-forks andasan akremargoubi patel-manas williamrogersdev suyogkh drxddy e-ntro-py harishphk nomis51 metamert murtatrxx berzerkeer loilock zerdos acyanes icytv sketchlagoon apolo-sys codymikol illogikal garoze ohhkaneda krsbx mrcodechef thanx228 panchalkalpesh noshower dev-lester hisamafahri javascript-1024 sergiomasellis isaac-mcfadyen xtunqki anuragvohraec rishavbhowmik ro6 artart788 kansha15 skyneticist praveenpuglia ramiz03 mrowles tropix126 efichot sakadoddle proteandev sher codebymarcus hamidreza01bun's Issues
documentation updates for react section to easily integrate with existing CRA
(I can put up a PR if you're welcoming PRs)
Requires react
version >17 because of the react/jsx-dev-runtime
dependency for the compiler
if working with an existing CRA, you need to update ./public/index.html
to:
- remove
%PUBLIC_URL%
- add a
<script src="/src/index.js" async type="module"></script>
to the documentbody
.
I don't know if you have intentions to include support within bun
to handle this out of the box.
I'd imagine if bun is going to be only for development workflows, then you wouldn't want to mess with the index.html
file.
Support macros in Bun.js SSR
Print import stack for errors during `bun bun`
That way you know exactly what files led to the error happening
Improve reliability of CommonJS <> ESM interop
Importing either CommonJS or ES Modules should work at least as well as it does on Node.js and/or Webpack.
While the common case often works fine, there are many edgecases to consider:
- Why doesn't
@mdx-js/runtime
work correctly? Currently, it throws due tomodule.exports.default
being marked read only. This is a symptom of a larger issue. One possible fix here is to change all assignments tomodule.exports
to happen viaObject.defineProperty
instead of an assignment. This change should happen in the JS parser and not the printer. - Functions that recursively loop over the keys of an exported module/namespace eventually stack overflow. This happens because we currently set
default
to point to module.exports, i.e.module.exports.default === module.exports
. This solves many issues with CommonJS interop, but ultimately is too fragile to keep. A better solution is wrapping in arequire
which checks for the existence of aSymbol
marked as non-enumerable.
However, fixing one-off issues like these as they happen will not produce reliable software. These problems need to be fixed, but to ensure they stay fixed, an integration test suite that runs popular NPM packages and makes sure they successfully load/execute is a better plan. That should be run in an untrusted environment, like a GitHub actions runner and it should not have any permissions or secret keys. It should just have a bun
binary preinstalled.
Copy source code contents of .bun files when `bun build`
highlight.js fails to resolve
Most likely it's assuming highlight.js
is a file path and not a package path.
Fix errors in `bun bun` (broke after threading)
Disable reuseport, automatically choose next closest port on error.AddressInUse
- warn
Support import assertions
It should probably remove them from the output since browser support is scarce. A better plan, more broadly, is for decisions like this to be configurable instead of just me saying stuff.
Fix regression with `"\0"`
This breaks compiling Babel with Bun.
Add support for Next 12
Allow spaces in paths
Currently Bun doesn't escape spaces in paths which result in a truncated path & is causing module not found errors.
Consider loading .env
Create a build of Bun that doesn’t need AVX2 instructions
This can be feature detected in the install script
It’s really stupid for people to be unable to use Bun on older computers
`private` inside function arguments (field notation)
via @Vbitz https://discord.com/channels/876711213126520882/887787428973281300/905657075185639465
This code:
class Testing {
constructor(private hello: string) {}
toString() {
return this.hello;
}
}
Fails with:
error: Expected ")" but found hello
constructor(private hello: string) {}
It should transpile to:
class Testing {
constructor(hello) {}
toString() {
return this.hello;
}
}
"Imported binding name not found" error missing source file name
Errors seen when environment exports functions
Errors seen when invoking bun from a bash environment with exported functions (e.g. as used by nvs / nvm):
To reproduce, simple package.json:
{
"scripts": {
"invoke-ls": "ls"
}
}
Then in a bash instance:
# Define a function (details aren't important)
fn() { :; }
# The important bit: export the function
export -f fn
bun run invoke-ls
Error output seen:
$ ls
/usr/local/bin/bash: fn: line 1: syntax error: unexpected end of file
/usr/local/bin/bash: error importing function definition for `fn'
...followed by actual output of ls...
Fix 404 when navigating to routes like /posts/[id]
Always replace `global` with `globalThis`
Rewrite the CLI to use subcommands and be clearer
Embed `react-refresh` into Bun's binary
This is so you don't have to install it. Nobody is going to remember to install this package, and this seems safe to do because it very infrequently updates. Without react-refresh
, React Fast Refresh doesn't work.
https://github.com/facebook/react/commits/main/packages/react-refresh
Fix macro loading so it doesn't need a symlink
Convert all stored paths in .bun to project-relative
This will prevent errors when user A tries to load a persisted node_modules.bun
Bare imports of CommonJS modules transformed to ESM should be eagerly-loaded to match Node.js behavior
This:
import * as $bbcd215f from "http://localhost:3000/node_modules/react/index.js";
Should be:
import * as $bbcd215f from "http://localhost:3000/node_modules/react/index.js";
require($bbcd215f);
Add a way for frameworks to define env vars
error: Unterminated string literal
Bun 0.44 shows an error when parsing a long array of strings:
Error: SyntaxError
warn: Please run `bun bun` from a directory containing a package.json.
error: Unterminated string literal
Found with a small project:
yarn add faker
Create index.js
:
require('faker');
This then errors:
bun bun ./index.js
`bun upgrade` does not appear to use HTTPS_ PROXY?
Fix unicode interop between JSC <> Zig
This affects:
fetch()
- Macros
console.log
Bun.readFileAsString
Bun.readFile
The fix is most likely auto-converting to UTF-8 when calling toZigString
, but having some way of tracking memory. Perhaps doing this where it is garbage collected rather than manually managed.
Fix ?? operator
in:
var hello = foo ?? "world";
current out:
var hello = foo;
expected out:
var hello = foo ?? "world";
Inline runtime imports when building single files
Fix calling #private() functions in classes
in:
class foo {
#private() {
this.#bar();
}
#bar() {}
}
current out:
❯ ./build/debug/macos-x86_64/esdev ./src/test/fixtures/nullish-coalesce.js
error: Unexpected private identifier. This is an internal error - not your fault.
}
src/test/fixtures/nullish-coalesce.js:6:2 62
thread 14325726 panic:
error: Unexpected private identifier. This is an internal error - not your fault.
}
src/test/fixtures/nullish-coalesce.js:6:2 62
/Users/jarred/Code/esdev/src/global.zig:343:28: 0x10ac5f8e0 in src.global.Global.panic (esdev)
std.debug.panic(fmt, args);
^
/Users/jarred/Code/esdev/src/js_parser/js_parser.zig:8992:25: 0x10aab30bb in src.js_parser.js_parser.NewParser((struct src.js_parser.js_parser.ParserFeatures constant)).panic (esdev)
Global.panic("{s}", .{panic_buffer});
^
/Users/jarred/Code/esdev/src/js_parser/js_parser.zig:10361:28: 0x10a7b47e8 in src.js_parser.js_parser.NewParser((struct src.js_parser.js_parser.ParserFeatures constant)).visitExprInOut (esdev)
p.panic("Unexpected private identifier. This is an internal error - not your fault.", .{});
^
/Users/jarred/Code/esdev/src/js_parser/js_parser.zig:10179:20: 0x10a7ae0a2 in src.js_parser.js_parser.NewParser((struct src.js_parser.js_parser.ParserFeatures constant)).visitExpr (esdev)
return @call(.{ .modifier = .always_inline }, P.visitExprInOut, .{ p, expr, ExprIn{} });
^
/Users/jarred/Code/esdev/src/js_parser/js_parser.zig:10862:47: 0x10a7b6871 in src.js_parser.js_parser.NewParser((struct src.js_parser.js_parser.ParserFeatures constant)).visitExprInOut (esdev)
e_.index = p.visitExpr(e_.index);
^
/Users/jarred/Code/esdev/src/js_parser/js_parser.zig:11216:49: 0x10a7b87ca in src.js_parser.js_parser.NewParser((struct src.js_parser.js_parser.ParserFeatures constant)).visitExprInOut (esdev)
e_.target = p.visitExprInOut(e_.target, ExprIn{
^
/Users/jarred/Code/esdev/src/js_parser/js_parser.zig:10179:20: 0x10a7ae0a2 in src.js_parser.js_parser.NewParser((struct src.js_parser.js_parser.ParserFeatures constant)).visitExpr (esdev)
return @call(.{ .modifier = .always_inline }, P.visitExprInOut, .{ p, expr, ExprIn{} });
^
/Users/jarred/Code/esdev/src/js_parser/js_parser.zig:12031:45: 0x10a7a76b0 in src.js_parser.js_parser.NewParser((struct src.js_parser.js_parser.ParserFeatures constant)).visitAndAppendStmt (esdev)
data.value = p.visitExpr(data.value);
^
/Users/jarred/Code/esdev/src/js_parser/js_parser.zig:13238:41: 0x10a7a4e0f in src.js_parser.js_parser.NewParser((struct src.js_parser.js_parser.ParserFeatures constant)).visitStmts (esdev)
try p.visitAndAppendStmt(list, stmt);
^
/Users/jarred/Code/esdev/src/js_parser/js_parser.zig:10153:29: 0x10a7a441a in src.js_parser.js_parser.NewParser((struct src.js_parser.js_parser.ParserFeatures constant)).visitStmtsAndPrependTempRefs (esdev)
try p.visitStmts(stmts, opts.kind);
^
/Users/jarred/Code/esdev/src/js_parser/js_parser.zig:10218:43: 0x10a7aca15 in src.js_parser.js_parser.NewParser((struct src.js_parser.js_parser.ParserFeatures constant)).visitFunc (esdev)
p.visitStmtsAndPrependTempRefs(&stmts, &temp_opts) catch unreachable;
^
/Users/jarred/Code/esdev/src/js_parser/js_parser.zig:11284:42: 0x10a7b8c54 in src.js_parser.js_parser.NewParser((struct src.js_parser.js_parser.ParserFeatures constant)).visitExprInOut (esdev)
e_.func = p.visitFunc(e_.func, expr.loc);
^
/Users/jarred/Code/esdev/src/js_parser/js_parser.zig:10179:20: 0x10a7ae0a2 in src.js_parser.js_parser.NewParser((struct src.js_parser.js_parser.ParserFeatures constant)).visitExpr (esdev)
return @call(.{ .modifier = .always_inline }, P.visitExprInOut, .{ p, expr, ExprIn{} });
^
/Users/jarred/Code/esdev/src/js_parser/js_parser.zig:13127:53: 0x10a7ad278 in src.js_parser.js_parser.NewParser((struct src.js_parser.js_parser.ParserFeatures constant)).visitClass (esdev)
property.value = p.visitExpr(val);
^
/Users/jarred/Code/esdev/src/js_parser/js_parser.zig:12331:52: 0x10a7a8a18 in src.js_parser.js_parser.NewParser((struct src.js_parser.js_parser.ParserFeatures constant)).visitAndAppendStmt (esdev)
const shadow_ref = p.visitClass(stmt.loc, &data.class);
^
/Users/jarred/Code/esdev/src/js_parser/js_parser.zig:13238:41: 0x10a7a4e0f in src.js_parser.js_parser.NewParser((struct src.js_parser.js_parser.ParserFeatures constant)).visitStmts (esdev)
try p.visitAndAppendStmt(list, stmt);
^
^C⏎
expected out:
class foo {
#private() {
this.#bar();
}
#bar() {}
}
Or transpile it using the WeakMap
technique. Probably transpile it since Safari support isn't great for all the syntax.
`require` a node_module that is bundled inside a file which is not bundled uses the wrong symbol name
Spaces and quotes aren't handled correctly by bun run
package.json:
Fix Catalina support
Need to set the minimum OS target in the build.zig
file for macOS x64.
Shouldn't be any other code changes.
Filing an issue so I remember
test
Fix JSX parser bug: `// comment` after tagName and before closing tag is broken
Example:
<img
// data-parent-fit="contain"
data-parent-container={`.${mediaSizerClassName}`}
onClick={onClick}
/>
Fix regression with JSX entities introduced in v0.0.40
Copy source lines when generating error messages
Since we recycle source code buffers, if we don't immediately print error messages (most of the time we print later), the printed sourcecode is potentially garbage memory & often from the wrong file
While we're at it, we probably should implement the SourceLineTracker thing esbuild does to make generating the error location info faster
Audit everywhere an error is thrown and check that it emits something more helpful than the @errorName
Add a fast `npm install` to Bun's CLI
this is mostly stream of conscious
Why?
npm install
is too slow.- Resolving node_modules is too slow. This affects bundlers and Node.js (bun as well)
How to make npm install
faster
- Tooling written in Zig launches much faster than Node.js-based tooling by default
- binary lockfile format
- Use a faster zlib library to go from
.tar.gz
->.tar
. cloudflare's zlib or https://github.com/ebiggers/libdeflate - On Linux, use io_uring for I/O
- Parsing semver versions & ranges should not use regex and allocate as little memory as possible. No copying strings around
The disk cache is a question I'm still thinking about.
- Probably wouldn't do caching via many small files on disk. Many small files == a lot of syscall overhead and npm clients are performance constrained by (1) network latency to resolve dependent package versions, (2) downloading files and (3) syscall overhead. The common case of running
npm install
on a package with a lockfile and no changes to dependencies is almost entirely constrained by syscall overhead. - A memory-mapped database such as LMDB could be fast, but I worry about reliability and remote filesystems. It could detect, warn & disable the cache if the filesystem is remote.
- SQLite is a safe bet, but writes aren't very fast. It would be interesting to try storing blobs inside a
"packages"
table. Store package names, last updated, then a blob which is a semver sorted array of versions that are known to exist in the registry. Don't bother to cache any of the rest of the package.json, reparse it each time.
The purpose of this disk cache would solely be for preventing the extra network trip to the NPM registry to resolve package versions
Then, for storing the .tar.gz
files, I would try just sticking them all in a big folder. The problem with large folders is reading the directory entries gets slower. To fix that, I'd try an index file which would be a binary file with a default name like index.cache
that would effectively be a hash table stored on disk where the keys are filenames. I would test that this is faster in practice than just attempting to open the .tar.gz
which may not exist and handling the error. I would also test if using LMDB is worthwhile for this too.
A lockfile format that makes other tooling faster
npm clients & bundlers both have to traverse node_modules
. npm clients know the entire directory tree at package install time, but do not expose this information to other tooling.
Bun would do this differently.
A hypothetical bun install
would persist a lockfile with the entire node_modules directory tree metadata in one binary lockfile and a subset of each package.json relevant to bundling (along with resolved versions and the resolution method, such as whether it was a .tar.gz file or a URL import). This would dramatically reduce the number of syscalls necessary to resolve imports. Instead of calling getdents()
for nearly every directory in node_modules, bundlers could attempt to open file paths directly
URL imports could become "packages" via this lockfile as well.
The lockfile schema would be written using peechy, which would enable JavaScript and Go tooling to consume it as well.
For reviewability, this would be an executable file which on execution would print a human-readable version of the file (same as .bun
files). Assumption: in practice, engineers largely don't review lockfiles by reading them. github bots are fundamentally better suited to surfacing changes in lockfiles for humans to review
Like with .bun
files, the metadata would be numbers and pointers to byte offsets pointing to a single large combined string at the bottom of the file, which makes reading this potentially large file faster.
For symlinks and workspace packages, it wouldn't persist a directory tree. Those would quickly become outdated.
Allow build to output code that runs on Node.js
Bun does not emit code that runs in Node.js. It's very close to doing that, but does not yet.
Blockers:
-
require
shouldn't import the bundler runtime -
node:fs
and othernode:*
prefixes need to be marked as external - Parallelize
bun build
for performance - Output as CommonJS?
The best approach might be a Node.js require
and/or ESM loader hook. This would involve using NP-API and writing C bindings. This would make the filesystem watcher work in Node.
Configurable feature map
Right now, the bundler always transpiles effectively to ESNext
. This should be configurable, and a limited amount of backwards-compatibility should be possible. Don't need to go as far back as ES6, but perhaps specifically last 2 versions
for Safari.
Windows Support
The README and releases tab implies that Windows is not supported for this project.
Is this due to WebKit (JavaScriptCore) being exclusive to *nix platforms (Linux, macOS)?
Are there any plans to support Windows?
The project works great on linux btw 😀🚀
Finish implementing React Fast Refresh transforms
Exported components correctly register with react-refresh/runtime
. But:
- Non-exported components need to be registered
- Hooks need to be registered
- When building from websockets, the signature hashes need to be generated.
The current version may blow away state changes.
Fix `browser` map
-
Options.Platform.bun
should import what browsers do -
Options.Platform.browser
should import what browsers do -
Options.Platform.neutral
should import what browsers do -
Options.Platform.node
should ignore it
These are good test cases:
import algoliasearch from 'algoliasearch/lite'
import { captureException, Severity } from '@sentry/nextjs'
Setup integration tests that run a headless browser and HMR end-to-end
Add support for importing URLs in JavaScript
Example:
import { a, b, c } from "https://example.com/modules/some/module.js"
Rewrite `ByteBuffer` in `peechy` to export functions instead of a class so that it tree shakes
Runtime for the bundler is 45kb which is stupidly big and most of that is peechy.
Colorize log output for errors printed to STDERR
Method calls on numeric literals
Error seen when hot reloading code in Chrome:
Uncaught SyntaxError: Invalid or unexpected token
Using bun dev
using bun version 0.0.48. Code within an npm package included this expression:
parseFloat((0.0).toPrecision(precision) + '1')
The code hot-reloaded was:
parseFloat(0.toPrecision(precision) + '1')
It appears bun removed the parenthesis around the number, rendering the code syntactically invalid.
FWIW: adding a space would make it valid:
parseFloat(0 .toPrecision(precision) + '1')
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.