Pulled ALL skills from 15 source repositories: - anthropics/skills: 16 (docs, design, MCP, testing) - obra/superpowers: 14 (TDD, debugging, agents, planning) - coreyhaines31/marketingskills: 25 (marketing, CRO, SEO, growth) - better-auth/skills: 5 (auth patterns) - vercel-labs/agent-skills: 5 (React, design, Vercel) - antfu/skills: 16 (Vue, Vite, Vitest, pnpm, Turborepo) - Plus 13 individual skills from various repos Mosaic Stack is not limited to coding — the Orchestrator and subagents serve coding, business, design, marketing, writing, logistics, analysis, and more. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
118 lines
2.3 KiB
Markdown
118 lines
2.3 KiB
Markdown
# Customizing Rolldown Options
|
|
|
|
Pass options directly to the underlying Rolldown bundler.
|
|
|
|
## Overview
|
|
|
|
tsdown uses [Rolldown](https://rolldown.rs) as its core bundling engine. You can override Rolldown's input and output options directly for fine-grained control.
|
|
|
|
**Warning:** You should be familiar with Rolldown's behavior before overriding options. Refer to the [Rolldown Config Options](https://rolldown.rs/options/input) documentation.
|
|
|
|
## Input Options
|
|
|
|
### Using an Object
|
|
|
|
```ts
|
|
export default defineConfig({
|
|
inputOptions: {
|
|
cwd: './custom-directory',
|
|
},
|
|
})
|
|
```
|
|
|
|
### Using a Function
|
|
|
|
Dynamically modify options based on the output format:
|
|
|
|
```ts
|
|
export default defineConfig({
|
|
inputOptions(inputOptions, format) {
|
|
inputOptions.cwd = './custom-directory'
|
|
return inputOptions
|
|
},
|
|
})
|
|
```
|
|
|
|
## Output Options
|
|
|
|
### Using an Object
|
|
|
|
```ts
|
|
export default defineConfig({
|
|
outputOptions: {
|
|
legalComments: 'inline',
|
|
},
|
|
})
|
|
```
|
|
|
|
### Using a Function
|
|
|
|
```ts
|
|
export default defineConfig({
|
|
outputOptions(outputOptions, format) {
|
|
if (format === 'esm') {
|
|
outputOptions.legalComments = 'inline'
|
|
}
|
|
return outputOptions
|
|
},
|
|
})
|
|
```
|
|
|
|
## Common Use Cases
|
|
|
|
### Preserve Legal Comments
|
|
|
|
```ts
|
|
export default defineConfig({
|
|
entry: ['src/index.ts'],
|
|
outputOptions: {
|
|
legalComments: 'inline',
|
|
},
|
|
})
|
|
```
|
|
|
|
### Custom Working Directory
|
|
|
|
```ts
|
|
export default defineConfig({
|
|
entry: ['src/index.ts'],
|
|
inputOptions: {
|
|
cwd: './packages/my-lib',
|
|
},
|
|
})
|
|
```
|
|
|
|
### Format-Specific Options
|
|
|
|
```ts
|
|
export default defineConfig({
|
|
entry: ['src/index.ts'],
|
|
format: ['esm', 'cjs'],
|
|
outputOptions(outputOptions, format) {
|
|
if (format === 'esm') {
|
|
outputOptions.legalComments = 'inline'
|
|
}
|
|
return outputOptions
|
|
},
|
|
})
|
|
```
|
|
|
|
## When to Use
|
|
|
|
- When tsdown doesn't expose a specific Rolldown option
|
|
- For format-specific Rolldown customizations
|
|
- For advanced bundling scenarios
|
|
|
|
## Tips
|
|
|
|
1. **Read Rolldown docs** before overriding options
|
|
2. **Use functions** for format-specific customization
|
|
3. **Test thoroughly** when overriding defaults
|
|
4. **Prefer tsdown options** when available (e.g., use `minify` instead of setting it via `outputOptions`)
|
|
|
|
## Related
|
|
|
|
- [Plugins](advanced-plugins.md) - Plugin system
|
|
- [Hooks](advanced-hooks.md) - Lifecycle hooks
|
|
- [Config File](option-config-file.md) - Configuration options
|