npm.io
0.11.3 • Published 1 week ago

@distilled.cloud/cloudflare-rolldown-plugin

Licence
MIT
Version
0.11.3
Deps
3
Size
95 kB
Vulns
0
Weekly
33.4K

@distilled.cloud/cloudflare-rolldown-plugin

Rolldown plugin for Cloudflare Workers.

Install

bun add @distilled.cloud/cloudflare-rolldown-plugin rolldown

Usage

import { rolldown } from "rolldown";
import cloudflare from "@distilled.cloud/cloudflare-rolldown-plugin";

const bundle = await rolldown({
  input: "./src/index.ts",
  plugins: [
    cloudflare({
      compatibilityDate: "2026-04-01",
      compatibilityFlags: ["nodejs_compat"],
    }),
  ],
});

await bundle.write({
  file: "./dist/index.js",
  format: "esm",
  sourcemap: true,
});

What It Does

  • Applies Cloudflare-friendly Rolldown defaults for resolution and output targeting.
  • Treats supported cloudflare:* imports as external.
  • Enables Node.js compatibility shims when nodejs_compat is set.
  • Supports Cloudflare-style additional modules for .wasm, .bin, .txt, .html, and .sql.
  • Supports .wasm?init imports.

Options

  • compatibilityDate?: string
  • compatibilityFlags?: string[]

License

MIT

Keywords