Skip to content

Commit 835dbf4

Browse files
committed
docs: update readme
1 parent 88ce636 commit 835dbf4

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,21 @@ Here's a example of entry files and exports configuration:
9494
}
9595
```
9696
97+
#### Wildcard Exports
98+
99+
`bunchee` supports wildcard patterns in the `exports` field to automatically generate exports for multiple files:
100+
101+
```json5
102+
{
103+
"exports": {
104+
".": "./dist/index.js",
105+
"./features/*": "./dist/features/*.js"
106+
}
107+
}
108+
```
109+
110+
This will automatically discover files in `src/features/` and generate exports like `./features/foo`, `./features/bar`, etc. The wildcard `*` is substituted in both the export path and output path.
111+
97112
### Output Formats
98113
99114
**bunchee** detects the format of each entry-point based on export condition type or the file extension. It supports the following output formats:
@@ -215,6 +230,15 @@ This will match the `bin` field in package.json as:
215230

216231
> Note: For multiple `bin` files, the filename should match the key name in the `bin` field.
217232
233+
### Native Addon (.node) Support
234+
235+
`bunchee` supports bundling native Node.js addon files (`.node` binaries). When you import a `.node` file, it will be copied to the output directory and the import will be rewritten to load it at runtime.
236+
237+
```js
238+
// src/index.js
239+
import addon from './native-addon.node'
240+
```
241+
218242
### Server Components
219243

220244
**bunchee** supports building React Server Components and Server Actions with directives like `"use client"` or `"use server"`. It generates separate chunks for the server or client boundaries. When integrated to framework like Next.js, it can correctly handles the boundaries with the split chunks.

0 commit comments

Comments
 (0)