跳到正文

Variable: rolldown()

ts
const rolldown: (input) => Promise<RolldownBuild>

Defined in: node_modules/.pnpm/rolldown@1.0.0-rc.1/node_modules/rolldown/dist/shared/define-config-DO4TBkJV.d.mts:1199

The API compatible with Rollup's rollup function.

Unlike Rollup, the module graph is not built until the methods of the bundle object are called.

Parameters

input

InputOptions

The input options object.

Returns

Promise<RolldownBuild>

A Promise that resolves to a bundle object.

Example

js
import { rolldown } from 'rolldown'

let bundle,
  failed = false
try {
  bundle = await rolldown({
    input: 'src/main.js',
  })
  await bundle.write({
    format: 'esm',
  })
} catch (e) {
  console.error(e)
  failed = true
}
if (bundle) {
  await bundle.close()
}
process.exitCode = failed ? 1 : 0

Released under the MIT License.