This commit is contained in:
Jarred Sumner
2021-10-26 17:09:38 -07:00
parent 933378ab80
commit 221b280856
3 changed files with 7 additions and 6 deletions

View File

@@ -52,10 +52,6 @@ bun run clean
bun clean
```
For maximum performance, any scripts that invoke `npm run`, `yarn run`, or `pnpm run` will automatically be replaced in-memory with `bun run`. This means you can try `bun run` in existing codebases that aren't using Bun and get an immediate performance boost.
`bun run` supports lifecycle hooks like `post${task}` and `pre{task}`, adds `node_modules/.bin` to `$PATH` (for all parent `node_modules` folders), and automatically loads `.env` files if they exist. Like with yarn, you can use `bun run` without typing `run` (but any new subcommands will override it, so be warned!)
## Using Bun with Next.js
To create a new Next.js app with Bun:
@@ -184,7 +180,6 @@ Bun is a project with incredibly large scope, and it's early days.
| Sharing `.bun` files | Bun |
| [Finish fetch](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) | Bun.js |
| [setTimeout](https://developer.mozilla.org/en-US/docs/Web/API/setTimeout) | Bun.js |
| `bun run` command | Bun.js |
<sup>JS Transpiler == JavaScript Transpiler</sup><br/>
<sup>TS Transpiler == TypeScript Transpiler</sup><br/>
@@ -524,6 +519,8 @@ The default shell it uses is `bash`, but if that's not found, it tries `sh` and
`bun run` automatically adds any parent `node_modules/.bin` to `$PATH` and if no scripts match, it will load that binary instead. That means you can run executables from packages too.
`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.
```bash
# If you use Relay
bun run relay-compiler

View File

@@ -458,6 +458,7 @@ const HelpCommand = struct {
\\> <r> <b><green>dev <r><d> ./a.ts ./b.jsx<r> Start a Bun Dev Server
\\> <r> <b><magenta>bun <r><d> ./a.ts ./b.jsx<r> Bundle dependencies of input files into a <r><magenta>.bun<r>
\\> <r> <b><cyan>create <r><d> next ./app<r> Start a new project from a template <d>(shorthand: c)<r>
\\> <r> <b><green>run <r><d> test <r> Run a package.json script or executable<r>
\\> <r> <b><blue>discord <r> Open Bun's Discord server
\\> <r> <b><d>help <r> Print this help menu
\\

View File

@@ -601,11 +601,14 @@ pub const defaultLoaders = std.ComptimeStringMap(Loader, .{
.{ ".jsx", Loader.jsx },
.{ ".json", Loader.json },
.{ ".js", Loader.jsx },
.{ ".mjs", Loader.js },
.{ ".cjs", Loader.js },
.{ ".css", Loader.css },
.{ ".ts", Loader.ts },
.{ ".tsx", Loader.tsx },
.{ ".cjs", Loader.js },
.{ ".mts", Loader.ts },
.{ ".cts", Loader.ts },
});