Skip to content

Notable Features ​

This page documents some notable features in Rolldown that do not have built-in equivalents in Rollup.

Platform presets ​

  • Configurable via the platform option.
  • Default: 'node' for cjs output, 'browser' otherwise
  • Possible values: browser | node | neutral

Similar to esbuild's platform option, this option provides some sensible defaults regarding module resolution and how to handle process.env.NODE_ENV.

Notable differences from esbuild:

  • The default output format is always esm regardless of platform.

TIP

Rolldown does not polyfill Node built-ins when targeting the browser. You can opt-in to it with rolldown-plugin-node-polyfills.

Built-in transforms ​

Rolldown supports the following transforms out of the box, powered by Oxc. The transform is configurable via the transform option. The following transforms are supported:

  • TypeScript
    • Sets configurations based on the tsconfig.json when the tsconfig option is provided.
    • Supported legacy decorators and decorator metadata.
  • JSX
  • Syntax lowering
    • Automatically transforms modern syntax to be compatible with your defined target.
    • Supports down to ES2015.

CJS support ​

Rolldown supports mixed ESM / CJS module graphs out of the box, without the need for @rollup/plugin-commonjs. It largely follows esbuild's semantics and passes all esbuild ESM / CJS interop tests.

See Bundling CJS for more details.

Module resolution ​

Rolldown resolves modules based on TypeScript and Node.js' behavior by default, without the need for @rollup/plugin-node-resolve.

When top-level tsconfig option is provided, Rolldown will respect compilerOptions.paths in the specified tsconfig.json.

Define ​

This feature provides a way to replace global identifiers with constant expressions. Aligns with the respective options in Vite and esbuild.

@rollup/plugin-replace behaves differently

Note it behaves differently from @rollup/plugin-replace as the replacement is AST-based, so the value to be replaced must be a valid identifier or member expression. Use the built-in replacePlugin for that purpose.

Inject ​

This feature provides a way to shim global variables with a specific value exported from a module. This feature is equivalent of @rollup/plugin-inject and conceptually similar to esbuild's inject option.

Manual Code Splitting ​

Rolldown allows controlling the chunking behavior granularly, similar to webpack's optimization.splitChunks feature.

See Manual Code Splitting for more details.

Module types ​

  • ⚠️ Experimental

This is conceptually similar to esbuild's loader option, allowing users to globally associate file extensions to built-in module types via the moduleTypes option, or specify module type of a specific module in plugin hooks. It is discussed in more details here.

Minification ​

The minification is powered by Oxc Minifier. See its documentation for more details.