diff options
author | 2023-05-29 11:49:51 -0700 | |
---|---|---|
committer | 2023-05-29 11:49:51 -0700 | |
commit | 9b6913e1a674ceb7f670f917fc355bb8758c6c72 (patch) | |
tree | 9ff0bb4a8c22f8f9505242e5f0e6e40e795da0df /docs/bundler/plugins.md | |
parent | e2de1f5c133ed3aac6fcea7e8e7c5fcd771d65f9 (diff) | |
download | bun-9b6913e1a674ceb7f670f917fc355bb8758c6c72.tar.gz bun-9b6913e1a674ceb7f670f917fc355bb8758c6c72.tar.zst bun-9b6913e1a674ceb7f670f917fc355bb8758c6c72.zip |
More/better docs for JSX, utils, binary data, streams, hashing, `bun test`, `Bun.serve` (#3005)
* WIP
* Updates
* Document deepEquals
* WIP
* Update typeS
* Update TLS docs for Bun.serve
* Update types for tls
* Draft binary data page. Add Streams page.
* Update test runner docs
* Add hashing, flesh out utils
* Grammar
* Update types
* Fix
* Add import.meta docs
* Tee
Diffstat (limited to '')
-rw-r--r-- | docs/bundler/plugins.md | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/docs/bundler/plugins.md b/docs/bundler/plugins.md index 37f8ce66e..4e0fafee5 100644 --- a/docs/bundler/plugins.md +++ b/docs/bundler/plugins.md @@ -31,6 +31,16 @@ Bun.build({ }); ``` +<!-- It can also be "registered" with the Bun runtime using the `Bun.plugin()` function. Once registered, the currently executing `bun` process will incorporate the plugin into its module resolution algorithm. + +```ts +import {plugin} from "bun"; + +plugin(myPlugin); +``` --> + +## `--preload` + To consume this plugin, add this file to the `preload` option in your [`bunfig.toml`](/docs/runtime/configuration). Bun automatically loads the files/modules specified in `preload` before running a file. ```toml @@ -74,7 +84,7 @@ plugin( // application code ``` -Bun's plugin API is based on [esbuild](https://esbuild.github.io/plugins). Only [a subset](/docs/bundler/migration#plugin-api) of the esbuild API is implemented, but some esbuild plugins "just work" in Bun, like the official [MDX loader](https://mdxjs.com/packages/esbuild/): +Bun's plugin API is based on [esbuild](https://esbuild.github.io/plugins). Only [a subset](/docs/bundler/vs-esbuild#plugin-api) of the esbuild API is implemented, but some esbuild plugins "just work" in Bun, like the official [MDX loader](https://mdxjs.com/packages/esbuild/): ```jsx import { plugin } from "bun"; @@ -268,7 +278,7 @@ console.log(mySvelteComponent.render()); ## Reading `Bun.build`'s config -Plugins can read and write to the [build config](/docs/cli/build#api) with `build.config`. +Plugins can read and write to the [build config](/docs/bundler#api) with `build.config`. ```ts Bun.build({ |