mirror of
https://github.com/oven-sh/bun
synced 2026-02-02 15:08:46 +00:00
Start esbuild migration guide. More docs. (#2787)
* Bundler docs updates. Start esbuild migration guide. * Updates * Add JS API comp * Tweaks * Updates * Updates * Updates
This commit is contained in:
@@ -63,7 +63,7 @@ console.log(config);
|
||||
|
||||
{% /details %}
|
||||
|
||||
## Third party plugins
|
||||
## 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.
|
||||
|
||||
@@ -164,7 +164,7 @@ releaseYear: 2023
|
||||
|
||||
Note that the returned object has a `loader` property. This tells Bun which of its internal loaders should be used to handle the result. Even though we're implementing a loader for `.yaml`, the result must still be understandable by one of Bun's built-in loaders. It's loaders all the way down.
|
||||
|
||||
In this case we're using `"object"`—a special loader (intended for use by plugins) that converts a plain JavaScript object to an equivalent ES module. Any of Bun's built-in loaders are supported; these same loaders are used by Bun internally for handling files of various extensions.
|
||||
In this case we're using `"object"`—a built-in loader (intended for use by plugins) that converts a plain JavaScript object to an equivalent ES module. Any of Bun's built-in loaders are supported; these same loaders are used by Bun internally for handling files of various kinds. The table below is a quick reference; refer to [Bundler > Loaders](/docs/bundler/loaders) for complete documentation.
|
||||
|
||||
{% table %}
|
||||
|
||||
@@ -175,13 +175,13 @@ In this case we're using `"object"`—a special loader (intended for use by plug
|
||||
---
|
||||
|
||||
- `js`
|
||||
- `.js` `.mjs` `.cjs`
|
||||
- `.mjs` `.cjs`
|
||||
- Transpile to JavaScript files
|
||||
|
||||
---
|
||||
|
||||
- `jsx`
|
||||
- `.jsx`
|
||||
- `.js` `.jsx`
|
||||
- Transform JSX then transpile
|
||||
|
||||
---
|
||||
@@ -210,8 +210,20 @@ In this case we're using `"object"`—a special loader (intended for use by plug
|
||||
|
||||
---
|
||||
|
||||
- `napi`
|
||||
- `.node`
|
||||
- Import a native Node.js addon
|
||||
|
||||
---
|
||||
|
||||
- `wasm`
|
||||
- `.wasm`
|
||||
- Import a native Node.js addon
|
||||
|
||||
---
|
||||
|
||||
- `object`
|
||||
- —
|
||||
- _none_
|
||||
- A special loader intended for plugins that converts a plain JavaScript object to an equivalent ES module. Each key in the object corresponds to a named export.
|
||||
|
||||
{% /callout %}
|
||||
|
||||
Reference in New Issue
Block a user