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
identifiers: false, //It's better for you to make this false for better debugging during the running phase of the application.
62
+
keepNames: true
53
63
},
54
64
},
55
65
});
@@ -113,10 +123,22 @@ await server.start();
113
123
114
124
### buildOptions
115
125
116
-
**Type:**`BuildOptions`
117
-
**Default:**See below
126
+
**Type:**`BuildOptions` (optional)
127
+
**Default:**`{ outdir: './out' }` if not specified
118
128
119
-
Configuration options for Bun's bundler. Asena supports all Bun bundler options.
129
+
Configuration options for Bun's bundler. Asena exposes only backend-relevant build options from Bun's `BuildConfig`.
130
+
131
+
::: info Managed Internally
132
+
The `entrypoints` and `target` properties are managed internally by Asena CLI and cannot be configured by users. Asena always builds for the `bun` target since it's a Bun-native backend framework.
133
+
:::
134
+
135
+
**Available BuildOptions:**
136
+
-`outdir` - Output directory for compiled files
137
+
-`sourcemap` - Source map generation strategy
138
+
-`minify` - Code minification options
139
+
-`external` - Dependencies to exclude from bundling
140
+
-`format` - Output module format (ESM/CJS)
141
+
-`drop` - Remove function calls from bundle (e.g., `console`, `debugger`)
-**Production:** Use `'none'` for smaller bundle size
161
183
:::
162
184
163
-
### target
185
+
### format
186
+
187
+
**Type:**`'esm' | 'cjs'`
188
+
**Default:**`'esm'` (Bun's default)
189
+
190
+
Specifies the output module format.
191
+
192
+
```typescript
193
+
exportdefaultdefineConfig({
194
+
buildOptions: {
195
+
format: 'esm', // ES modules (recommended for Bun)
196
+
},
197
+
});
198
+
```
199
+
200
+
::: tip
201
+
Asena works best with ESM format since Bun has native ESM support. CJS is supported but not recommended unless you have specific compatibility requirements.
202
+
:::
203
+
204
+
### external
205
+
206
+
**Type:**`string[]`
207
+
**Default:**`[]` (empty array)
208
+
209
+
List of dependencies that should not be bundled into the output. Useful for native modules or dependencies that should be resolved at runtime.
- Native Node.js modules (e.g., `fs`, `path` - though Bun handles these)
221
+
- Database drivers with native bindings
222
+
- Large dependencies that should be installed separately
223
+
224
+
::: warning Native Dependencies
225
+
Some packages with native bindings (like `better-sqlite3`) must be marked as external to work correctly.
226
+
:::
227
+
228
+
### drop
164
229
165
-
**Type:**`'bun' | 'node' | 'browser'`
166
-
**Default:**`'bun'`
230
+
**Type:**`string[]`
231
+
**Default:**`[]` (empty array)
167
232
168
-
Specifies the compilation target runtime.
233
+
Removes specified function calls from the bundle during build. Commonly used to strip debugging code in production.
169
234
170
235
```typescript
171
236
exportdefaultdefineConfig({
172
237
buildOptions: {
173
-
target: 'bun', // Optimize for Bun runtime
238
+
drop: ['console', 'debugger'], // Remove all console calls and debugger statements
239
+
},
240
+
});
241
+
```
242
+
243
+
**Common values:**
244
+
-`'console'` - Removes all `console.*` calls
245
+
-`'debugger'` - Removes `debugger` statements
246
+
- Custom identifiers like `'logger.debug'`
247
+
248
+
::: danger Side Effects Warning
249
+
The `drop` option removes the entire call expression, including arguments, even if they have side effects. For example, `drop: ['console']` will turn `console.log(doSomething())` into nothing, so `doSomething()` will never execute.
250
+
:::
251
+
252
+
**Example - Production build:**
253
+
254
+
```typescript
255
+
exportdefaultdefineConfig({
256
+
sourceFolder: 'src',
257
+
rootFile: 'src/index.ts',
258
+
buildOptions: {
259
+
outdir: 'dist',
260
+
sourcemap: 'none',
261
+
minify: true,
262
+
drop: ['console', 'debugger'], // Clean production output
|`external`|`string[]`| Dependencies to exclude from bundling |[Bun Docs](https://bun.com/docs/bundler#external)|
487
+
|`format`|`'esm' \| 'cjs'`| Output module format |[Bun Docs](https://bun.com/docs/bundler#format)|
488
+
|`drop`|`string[]`| Remove function calls (e.g., `console`, `debugger`) |[Bun Docs](https://bun.com/docs/bundler#drop)|
381
489
382
-
**Common Options:**
490
+
::: warning Unsupported Options
491
+
Options like `target`, `entrypoints`, `splitting`, `define`, and `loader` are **not exposed** because they're either managed internally or not relevant for backend framework builds.
0 commit comments