Skip to content

Interface: InputOptions

Defined in: node_modules/.pnpm/[email protected]/node_modules/rolldown/dist/shared/define-config-kYHtCO-M.d.mts:1415

Extended by

Properties

checks?

ts
optional checks: ChecksOptions;

Defined in: node_modules/.pnpm/[email protected]/node_modules/rolldown/dist/shared/define-config-kYHtCO-M.d.mts:1626


context?

ts
optional context: string;

Defined in: node_modules/.pnpm/[email protected]/node_modules/rolldown/dist/shared/define-config-kYHtCO-M.d.mts:1633


cwd?

ts
optional cwd: string;

Defined in: node_modules/.pnpm/[email protected]/node_modules/rolldown/dist/shared/define-config-kYHtCO-M.d.mts:1447


debug?

ts
optional debug: object;

Defined in: node_modules/.pnpm/[email protected]/node_modules/rolldown/dist/shared/define-config-kYHtCO-M.d.mts:1628

sessionId?

ts
optional sessionId: string;

experimental?

ts
optional experimental: object;

Defined in: node_modules/.pnpm/[email protected]/node_modules/rolldown/dist/shared/define-config-kYHtCO-M.d.mts:1467

attachDebugInfo?

ts
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?

ts
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:

js
{
  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?

ts
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).

devMode?

ts
optional devMode: DevModeOptions;

disableLiveBindings?

ts
optional disableLiveBindings: boolean;

incrementalBuild?

ts
optional incrementalBuild: boolean;

Required to be used with watch mode.

nativeMagicString?

ts
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

js
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?

ts
optional onDemandWrapping: boolean;

resolveNewUrlToAsset?

ts
optional resolveNewUrlToAsset: boolean;

strictExecutionOrder?

ts
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?

ts
optional transformHiresSourcemap: boolean | "boundary";

viteMode?

ts
optional viteMode: boolean;

external?

ts
optional external: ExternalOption;

Defined in: node_modules/.pnpm/[email protected]/node_modules/rolldown/dist/shared/define-config-kYHtCO-M.d.mts:1418


input?

ts
optional input: InputOption;

Defined in: node_modules/.pnpm/[email protected]/node_modules/rolldown/dist/shared/define-config-kYHtCO-M.d.mts:1416


logLevel?

ts
optional logLevel: LogLevelOption;

Defined in: node_modules/.pnpm/[email protected]/node_modules/rolldown/dist/shared/define-config-kYHtCO-M.d.mts:1463


makeAbsoluteExternalsRelative?

ts
optional makeAbsoluteExternalsRelative: MakeAbsoluteExternalsRelative;

Defined in: node_modules/.pnpm/[email protected]/node_modules/rolldown/dist/shared/define-config-kYHtCO-M.d.mts:1627


moduleTypes?

ts
optional moduleTypes: ModuleTypes;

Defined in: node_modules/.pnpm/[email protected]/node_modules/rolldown/dist/shared/define-config-kYHtCO-M.d.mts:1466


onLog?

ts
optional onLog: OnLogFunction;

Defined in: node_modules/.pnpm/[email protected]/node_modules/rolldown/dist/shared/define-config-kYHtCO-M.d.mts:1464


onwarn?

ts
optional onwarn: OnwarnFunction;

Defined in: node_modules/.pnpm/[email protected]/node_modules/rolldown/dist/shared/define-config-kYHtCO-M.d.mts:1465


optimization?

ts
optional optimization: OptimizationOptions;

Defined in: node_modules/.pnpm/[email protected]/node_modules/rolldown/dist/shared/define-config-kYHtCO-M.d.mts:1632


platform?

ts
optional platform: "browser" | "node" | "neutral";

Defined in: node_modules/.pnpm/[email protected]/node_modules/rolldown/dist/shared/define-config-kYHtCO-M.d.mts:1460

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

ts
- 'node' if the format is 'cjs'
- 'browser' for other formats

plugins?

ts
optional plugins: RolldownPluginOption;

Defined in: node_modules/.pnpm/[email protected]/node_modules/rolldown/dist/shared/define-config-kYHtCO-M.d.mts:1417


preserveEntrySignatures?

ts
optional preserveEntrySignatures: false | "strict" | "allow-extension" | "exports-only";

Defined in: node_modules/.pnpm/[email protected]/node_modules/rolldown/dist/shared/define-config-kYHtCO-M.d.mts:1631


resolve?

ts
optional resolve: object;

Defined in: node_modules/.pnpm/[email protected]/node_modules/rolldown/dist/shared/define-config-kYHtCO-M.d.mts:1419

alias?

ts
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?

ts
optional aliasFields: string[][];

conditionNames?

ts
optional conditionNames: string[];

exportsFields?

ts
optional exportsFields: string[][];

extensionAlias?

ts
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?

ts
optional extensions: string[];

mainFields?

ts
optional mainFields: string[];

mainFiles?

ts
optional mainFiles: string[];

modules?

ts
optional modules: string[];
ts
optional symlinks: boolean;

tsconfigFilename?

ts
optional tsconfigFilename: string;
Deprecated

Use the top-level tsconfig option instead.


shimMissingExports?

ts
optional shimMissingExports: boolean;

Defined in: node_modules/.pnpm/[email protected]/node_modules/rolldown/dist/shared/define-config-kYHtCO-M.d.mts:1461


transform?

ts
optional transform: TransformOptions;

Defined in: node_modules/.pnpm/[email protected]/node_modules/rolldown/dist/shared/define-config-kYHtCO-M.d.mts:1624

Configure how the code is transformed. This process happens after the transform hook.

To transpile legacy decorators, you could use

js
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?

ts
optional treeshake: boolean | TreeshakingOptions;

Defined in: node_modules/.pnpm/[email protected]/node_modules/rolldown/dist/shared/define-config-kYHtCO-M.d.mts:1462


tsconfig?

ts
optional tsconfig: string | true;

Defined in: node_modules/.pnpm/[email protected]/node_modules/rolldown/dist/shared/define-config-kYHtCO-M.d.mts:1655

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 has references, the file extension is allowed, and the tsconfig's include/exclude patterns 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.paths and compilerOptions.baseUrl for path mapping
  • Transformer: Uses select compiler options (jsx, decorators, typescript, etc.)

NOTE

Priority: Top-level transform options always take precedence over tsconfig settings.

Default

ts
undefined (no tsconfig resolution)

watch?

ts
optional watch: false | WatcherOptions;

Defined in: node_modules/.pnpm/[email protected]/node_modules/rolldown/dist/shared/define-config-kYHtCO-M.d.mts:1625

Released under the MIT License.