diff options
author | 2022-12-21 14:39:35 -0800 | |
---|---|---|
committer | 2022-12-21 14:57:04 -0800 | |
commit | b9d143c99dfd65f77499ff85c2f3bf98ba018873 (patch) | |
tree | 9e3de66eb59f3c8559189dacff6fde5f15f2125b /README.md | |
parent | f40d6bd94d0d95fb95a0c1cff0783758efa86dff (diff) | |
download | bun-b9d143c99dfd65f77499ff85c2f3bf98ba018873.tar.gz bun-b9d143c99dfd65f77499ff85c2f3bf98ba018873.tar.zst bun-b9d143c99dfd65f77499ff85c2f3bf98ba018873.zip |
Add section about `--bun`
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -1353,6 +1353,20 @@ bun run relay-compiler --schema foo.graphql `bun run` supports lifecycle hooks like `post${task}` and `pre{task}`. If they exist, they will run, matching the behavior of npm clients. If the `pre${task}` fails, the next task will not be run. There is currently no flag to skip these lifecycle tasks if they exist, if you want that file an issue. +#### Run in Bun's JavaScript runtime + +When given a JavaScript/TypeScript-like file, by default `bun run` will run it in Bun's JavaScript runtime. + +With one caveat: if there's a `#!/usr/bin/env node` shebang, it will run it with Node.js instead by default. + +To always run in Bun, use `--bun`: + +```bash +bun run --bun my-script +``` + +This remaps `node` in `$PATH` for the duration of the task to `bun` so that anything trying to execute `node` will runs in Bun's JavaScript runtime instead. + ### `bun --hot` `bun --hot` enables hot reloading of code in Bun's JavaScript runtime. This is a very experimental feature available in Bun v0.2.0. |