@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
关于 @distilled.cloud/cloudflare-rolldown-plugin 的常见问题
@distilled.cloud/cloudflare-rolldown-plugin 是什么?
Rolldown plugin for Cloudflare Workers.注意:该包已被作者标记为弃用——Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
如何安装 @distilled.cloud/cloudflare-rolldown-plugin?
在项目目录运行 npm install @distilled.cloud/cloudflare-rolldown-plugin,或使用 pnpm add / yarn add / bun add。
@distilled.cloud/cloudflare-rolldown-plugin 支持 TypeScript 吗?
支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。
@distilled.cloud/cloudflare-rolldown-plugin 支持 ESM 还是 CommonJS?
以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。
@distilled.cloud/cloudflare-rolldown-plugin 可以商用吗?
@distilled.cloud/cloudflare-rolldown-plugin 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。
@distilled.cloud/cloudflare-rolldown-plugin 的下载量有多少?
根据 npm 官方下载统计,@distilled.cloud/cloudflare-rolldown-plugin 在 2026/10/13 – 2026/11/11 这 30 天内被下载 163,943 次,日均约 5,465 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。
@distilled.cloud/cloudflare-rolldown-plugin 还在维护吗?
最新版本 0.17.1 发布于 2026/08/06(3 个月前);至今共发布 67 个版本,其中过去 12 个月发布了 67 个;首次发布于 2026/04/03。作者已将其标记为弃用,新项目建议寻找替代方案。