Interface: InputOptions
Defined in: node_modules/.pnpm/rolldown@1.0.0-beta.53/node_modules/rolldown/dist/shared/define-config-BS8Bt-r8.d.mts:1419
Extended by
Properties
checks?
optional checks: ChecksOptions;Defined in: node_modules/.pnpm/rolldown@1.0.0-beta.53/node_modules/rolldown/dist/shared/define-config-BS8Bt-r8.d.mts:1630
context?
optional context: string;Defined in: node_modules/.pnpm/rolldown@1.0.0-beta.53/node_modules/rolldown/dist/shared/define-config-BS8Bt-r8.d.mts:1637
cwd?
optional cwd: string;Defined in: node_modules/.pnpm/rolldown@1.0.0-beta.53/node_modules/rolldown/dist/shared/define-config-BS8Bt-r8.d.mts:1451
debug?
optional debug: object;Defined in: node_modules/.pnpm/rolldown@1.0.0-beta.53/node_modules/rolldown/dist/shared/define-config-BS8Bt-r8.d.mts:1632
sessionId?
optional sessionId: string;experimental?
optional experimental: object;Defined in: node_modules/.pnpm/rolldown@1.0.0-beta.53/node_modules/rolldown/dist/shared/define-config-BS8Bt-r8.d.mts:1471
attachDebugInfo?
optional attachDebugInfo: AttachDebugOptions;Attach debug information to the output bundle.
Type:
'none' | 'simple' | 'full'Default:
'simple'none: No debug information is attached.simple: Attach comments indicating which files the bundled code comes from. These comments could be removed by the minifier.full: Attach detailed debug information to the output bundle. These comments are using legal comment syntax, so they won't be removed by the minifier.
WARNING
You shouldn't use full in the production build.
chunkImportMap?
optional chunkImportMap:
| boolean
| {
baseUrl?: string;
fileName?: string;
};Enables automatic generation of a chunk import map asset during build.
This map only includes chunks with hashed filenames, where keys are derived from the facade module name or primary chunk name. It produces stable and unique hash-based filenames, effectively preventing cascading cache invalidation caused by content hashes and maximizing browser cache reuse.
The output defaults to importmap.json unless overridden via fileName. A base URL prefix (default "/") can be applied to all paths. The resulting JSON is a valid import map and can be directly injected into HTML via <script type="importmap">.
Example configuration snippet:
{
experimental: {
chunkImportMap: {
baseUrl: '/',
fileName: 'importmap.json'
}
},
plugins: [
{
name: 'inject-import-map',
generateBundle(_, bundle) {
const chunkImportMap = bundle['importmap.json'];
if (chunkImportMap?.type === 'asset') {
const htmlPath = path.resolve('index.html');
let html = fs.readFileSync(htmlPath, 'utf-8');
html = html.replace(
/<script\s+type="importmap"[^>]*>[\s\S]*?</script>/i,
`<script type="importmap">${chunkImportMap.source}</script>`
);
fs.writeFileSync(htmlPath, html);
delete bundle['importmap.json'];
}
}
}
]
}NOTE
If you want to learn more, you can check out the example here: examples/chunk-import-map
chunkModulesOrder?
optional chunkModulesOrder: ChunkModulesOrder;Control which order should use when rendering modules in chunk
Type: `'exec-order' | 'module-id'
Default:
'exec-order'exec-order: Almost equivalent to the topological order of the module graph, but specially handling when module graph has cycle.module-id: This is more friendly for gzip compression, especially for some javascript static asset lib (e.g. icon library)NOTE
Try to sort the modules by their module id if possible(Since rolldown scope hoist all modules in the chunk, we only try to sort those modules by module id if we could ensure runtime behavior is correct after sorting).
disableLiveBindings?
optional disableLiveBindings: boolean;hmr?
optional hmr: HmrOptions;incrementalBuild?
optional incrementalBuild: boolean;Required to be used with watch mode.
nativeMagicString?
optional nativeMagicString: boolean;Use native Rust implementation of MagicString for source map generation.
- Type:
boolean - Default:
false
MagicString is a JavaScript library commonly used by bundlers for string manipulation and source map generation. When enabled, rolldown will use a native Rust implementation of MagicString instead of the JavaScript version, providing significantly better performance during source map generation and code transformation.
Benefits
- Improved Performance: The native Rust implementation is typically faster than the JavaScript version, especially for large codebases with extensive source maps.
- Background Processing: Source map generation is performed asynchronously in a background thread, allowing the main bundling process to continue without blocking. This parallel processing can significantly reduce overall build times when working with JavaScript transform hooks.
- Better Integration: Seamless integration with rolldown's native Rust architecture.
Example
export default {
experimental: {
nativeMagicString: true,
},
output: {
sourcemap: true,
},
}NOTE
This is an experimental feature. While it aims to provide identical behavior to the JavaScript implementation, there may be edge cases. Please report any discrepancies you encounter. For a complete working example, see examples/native-magic-string
onDemandWrapping?
optional onDemandWrapping: boolean;resolveNewUrlToAsset?
optional resolveNewUrlToAsset: boolean;strictExecutionOrder?
optional strictExecutionOrder: boolean;Lets modules be executed in the order they are declared.
- Type:
boolean - Default:
false
This is done by injecting runtime helpers to ensure that modules are executed in the order they are imported. External modules won't be affected.
WARNING
Enabling this option may negatively increase bundle size. It is recommended to use this option only when absolutely necessary.
transformHiresSourcemap?
optional transformHiresSourcemap: boolean | "boundary";viteMode?
optional viteMode: boolean;external?
optional external: ExternalOption;Defined in: node_modules/.pnpm/rolldown@1.0.0-beta.53/node_modules/rolldown/dist/shared/define-config-BS8Bt-r8.d.mts:1422
input?
optional input: InputOption;Defined in: node_modules/.pnpm/rolldown@1.0.0-beta.53/node_modules/rolldown/dist/shared/define-config-BS8Bt-r8.d.mts:1420
logLevel?
optional logLevel: LogLevelOption;Defined in: node_modules/.pnpm/rolldown@1.0.0-beta.53/node_modules/rolldown/dist/shared/define-config-BS8Bt-r8.d.mts:1467
makeAbsoluteExternalsRelative?
optional makeAbsoluteExternalsRelative: MakeAbsoluteExternalsRelative;Defined in: node_modules/.pnpm/rolldown@1.0.0-beta.53/node_modules/rolldown/dist/shared/define-config-BS8Bt-r8.d.mts:1631
moduleTypes?
optional moduleTypes: ModuleTypes;Defined in: node_modules/.pnpm/rolldown@1.0.0-beta.53/node_modules/rolldown/dist/shared/define-config-BS8Bt-r8.d.mts:1470
onLog?
optional onLog: OnLogFunction;Defined in: node_modules/.pnpm/rolldown@1.0.0-beta.53/node_modules/rolldown/dist/shared/define-config-BS8Bt-r8.d.mts:1468
onwarn?
optional onwarn: OnwarnFunction;Defined in: node_modules/.pnpm/rolldown@1.0.0-beta.53/node_modules/rolldown/dist/shared/define-config-BS8Bt-r8.d.mts:1469
optimization?
optional optimization: OptimizationOptions;Defined in: node_modules/.pnpm/rolldown@1.0.0-beta.53/node_modules/rolldown/dist/shared/define-config-BS8Bt-r8.d.mts:1636
platform?
optional platform: "browser" | "node" | "neutral";Defined in: node_modules/.pnpm/rolldown@1.0.0-beta.53/node_modules/rolldown/dist/shared/define-config-BS8Bt-r8.d.mts:1464
Expected platform where the code run.
When the platform is set to neutral:
- When bundling is enabled the default output format is set to esm, which uses the export syntax introduced with ECMAScript 2015 (i.e. ES6). You can change the output format if this default is not appropriate.
- The main fields setting is empty by default. If you want to use npm-style packages, you will likely have to configure this to be something else such as main for the standard main field used by node.
- The conditions setting does not automatically include any platform-specific values.
Default
- 'node' if the format is 'cjs'
- 'browser' for other formatsplugins?
optional plugins: RolldownPluginOption;Defined in: node_modules/.pnpm/rolldown@1.0.0-beta.53/node_modules/rolldown/dist/shared/define-config-BS8Bt-r8.d.mts:1421
preserveEntrySignatures?
optional preserveEntrySignatures: false | "strict" | "allow-extension" | "exports-only";Defined in: node_modules/.pnpm/rolldown@1.0.0-beta.53/node_modules/rolldown/dist/shared/define-config-BS8Bt-r8.d.mts:1635
resolve?
optional resolve: object;Defined in: node_modules/.pnpm/rolldown@1.0.0-beta.53/node_modules/rolldown/dist/shared/define-config-BS8Bt-r8.d.mts:1423
alias?
optional alias: Record<string, string | false | string[]>;WARNING
resolve.alias will not call resolveId hooks of other plugin. If you want to call resolveId hooks of other plugin, use viteAliasPlugin from rolldown/experimental instead. You could find more discussion in this issue
aliasFields?
optional aliasFields: string[][];conditionNames?
optional conditionNames: string[];exportsFields?
optional exportsFields: string[][];extensionAlias?
optional extensionAlias: Record<string, string[]>;Map of extensions to alternative extensions.
With writing import './foo.js' in a file, you want to resolve it to foo.ts instead of foo.js. You can achieve this by setting: extensionAlias: { '.js': ['.ts', '.js'] }.
extensions?
optional extensions: string[];mainFields?
optional mainFields: string[];mainFiles?
optional mainFiles: string[];modules?
optional modules: string[];symlinks?
optional symlinks: boolean;tsconfigFilename?
optional tsconfigFilename: string;Deprecated
Use the top-level tsconfig option instead.
shimMissingExports?
optional shimMissingExports: boolean;Defined in: node_modules/.pnpm/rolldown@1.0.0-beta.53/node_modules/rolldown/dist/shared/define-config-BS8Bt-r8.d.mts:1465
transform?
optional transform: TransformOptions;Defined in: node_modules/.pnpm/rolldown@1.0.0-beta.53/node_modules/rolldown/dist/shared/define-config-BS8Bt-r8.d.mts:1628
Configure how the code is transformed. This process happens after the transform hook.
To transpile legacy decorators, you could use
export default defineConfig({
transform: {
decorator: {
legacy: true,
},
},
})For latest decorators proposal, rolldown is able to bundle them but doesn't support transpiling them yet.
treeshake?
optional treeshake: boolean | TreeshakingOptions;Defined in: node_modules/.pnpm/rolldown@1.0.0-beta.53/node_modules/rolldown/dist/shared/define-config-BS8Bt-r8.d.mts:1466
tsconfig?
optional tsconfig: string | true;Defined in: node_modules/.pnpm/rolldown@1.0.0-beta.53/node_modules/rolldown/dist/shared/define-config-BS8Bt-r8.d.mts:1659
Configures TypeScript configuration file resolution and usage.
Options
true: Auto-discovery mode (similar to Vite). For each module, both resolver and transformer will find the nearest tsconfig.json. If the tsconfig hasreferences, the file extension is allowed, and the tsconfig'sinclude/excludepatterns don't match the file, the referenced tsconfigs will be searched for a match. Falls back to the original tsconfig if no match is found.string: Path to a specific tsconfig.json file (relative to cwd or absolute path).
What's used from tsconfig
- Resolver: Uses
compilerOptions.pathsandcompilerOptions.baseUrlfor path mapping - Transformer: Uses select compiler options (jsx, decorators, typescript, etc.)
NOTE
Priority: Top-level transform options always take precedence over tsconfig settings.
Default
undefined (no tsconfig resolution)watch?
optional watch: false | WatcherOptions;Defined in: node_modules/.pnpm/rolldown@1.0.0-beta.53/node_modules/rolldown/dist/shared/define-config-BS8Bt-r8.d.mts:1629