You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+24Lines changed: 24 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -94,6 +94,21 @@ Here's a example of entry files and exports configuration:
94
94
}
95
95
```
96
96
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
+
97
112
### Output Formats
98
113
99
114
**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:
215
230
216
231
> Note: For multiple `bin` files, the filename should match the key name in the `bin` field.
217
232
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
+
importaddonfrom'./native-addon.node'
240
+
```
241
+
218
242
### Server Components
219
243
220
244
**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