aboutsummaryrefslogtreecommitdiff
path: root/docs/runtime/plugins.md
diff options
context:
space:
mode:
Diffstat (limited to 'docs/runtime/plugins.md')
-rw-r--r--docs/runtime/plugins.md14
1 files changed, 13 insertions, 1 deletions
diff --git a/docs/runtime/plugins.md b/docs/runtime/plugins.md
index de8885507..911d0ba1d 100644
--- a/docs/runtime/plugins.md
+++ b/docs/runtime/plugins.md
@@ -19,7 +19,15 @@ plugin({
});
```
-To consume this plugin, import it at the top of your project's entrypoint, before any application code is imported.
+To consume this plugin, add this file to the `preload` option in your [`bunfig.toml`](/docs/project/configuration). Bun automatically loads the files/modules specified in `preload` before running a file.
+
+```toml
+preload = ["./yamlPlugin.ts"]
+```
+
+{% details summary="Usage eithout preload" %}
+
+Alternatively, you can import this file manually at the top of your project's entrypoint, before any application code is imported.
```ts#app.ts
import "./yamlPlugin.ts";
@@ -28,6 +36,10 @@ import { config } from "./config.yml";
console.log(config);
```
+{% /details %}
+
+## Third party plugins
+
By convention, third-party plugins intended for consumption should export a factory function that accepts some configuration and returns a plugin object.
```ts